mpn_mul is embarrassingly slow

paul zimmermann Paul.Zimmermann at
Tue Apr 24 12:01:39 UTC 2018

> It is surely silly that we don't have any mpn call for when it is known
> that the multiplier and multiplicand are distinct.

but now that mpn_sqr is in the GMP interface (since GMP 6 I guess), why
check for {up,un} = {vp,vn} in mpn_mul? Shouldn't the user or the GMP
developer call mpn_sqr directly?

In "make check" of GMP 6.1.2, the "square" branch of mpn_mul is taken only
in 4 tests: mpf/t-sqrt, mpf/t-sqrt_ui, mpf/reuse and mpf/t-pow_ui. It seems
some of those cases are because there is no mpf_sqr function, and mpf_mul
calls mpn_mul without checking for squares.


More information about the gmp-devel mailing list