Small operands gcd improvements
Niels Möller
nisse at lysator.liu.se
Tue Aug 6 15:23:50 UTC 2019
tg at gmplib.org (Torbjörn Granlund) writes:
> nisse at lysator.liu.se (Niels Möller) writes:
>
> Here's a patch to take out gcd_11 to it's own C file, and call it from
> gcd_1.c. Needs documentation (if you agree it should be a public
> function), and it would be nice with separate tests for this function.
>
> If you want, feel free to commit!
Committed now, together with a tune/speed update.
> But perhaps put gcd_11 decl in gmp-impl.h, not gmp-h.in for now.
> If we make the function public, we move it back.
I'm open to moving it. But I think it's unlikely we'll need to make
incompatible changes.
> It is a shame the call is not tail-able due to the shift.
Could add an internal function with shift count as an argument. But I
suspect that is useful for mpn_gcd_1 only; when called from higher level
functions such as mpn_gcd, that won't work well, since shifted gcd may
exceed a limb.
> Should some current calls to gcd_1 be made into gcd_11 calls if
> HAVE_NATIVE_mpn_gcd_11? (Or perhaps if HAVE_NATIVE_mpn_gcd_11 || !
> HAVE_NATIVE_mpn_gcd_1, so that we don't cause slowdown while the asm
> code is not adapted!)
Maybe easier to wait until asm files are updated so that
HAVE_NATIVE_mpn_gcd_1 implies HAVE_NATIVE_mpn_gcd_11. Or was it some
particular call site you had in mind?
Regards,
/Niels
--
Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677.
Internet email is subject to wholesale government surveillance.
More information about the gmp-devel
mailing list