Squaring optimization in mpz_addmul/mpz_submul

Marco Bodrato bodrato at mail.dm.unipi.it
Sun May 29 17:25:13 CEST 2022


Ciao Fredrik,

Il 2022-05-25 22:48 Fredrik Johansson ha scritto:
> Now that mpn_mul no longer dispatches to mpn_sqr, the squaring
> optimization is missing in mpz_addmul/mpz_submul.

Thanks for spotting this!

>     mpz_addmul(sum, a, a);

> This should be easy to fix.

It is. I fixed it with a small patch.
https://gmplib.org/repo/gmp/rev/61ef108d740c

But I had to also add that case to the test program.
The case mpz_addmul(sum, a, a); was correctly handled,
but it wasn't tested.

And the case mpz_addmul(x, x, x); keeps on being untested!

Ĝis,
m

-- 
http://bodrato.it/papers/


More information about the gmp-devel mailing list