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 Mller  <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 Mller:
	* 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 Mller  <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.

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 Mller  <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 Mller  <nisse@lysator.liu.se>

	* tests/mpn/t-toom32.c (MIN_AN, MIN_BN, MAX_BN): Tightened requirements.
	* gmp-impl.h (mpn_toom32_mul_itch): Updated. Less scratch needed
	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 Mller  <<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 Mller  <nisse@lysator.liu.se>

	* tests/mpn/t-bdiv.c: Add red-zones.

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 Mller  <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.

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 Mller  <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 Mller  <nisse@lysator.liu.se>

	* tests/mpz/t-gcd.c (main): Added test case to exercise the
	unlikely u0 == u1 case in mpn_gcdext_lehmer_n.

	* mpn/generic/gcdext_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 Mller  <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 Mller  <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 Mller  <nisse@lysator.liu.se>

	* gmp-impl.h (udiv_qr_3by2): Fix typo in argument list.

2009-12-13  Niels Mller  <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 Mller  <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.
[--snip--]
