mpn_mul is embarrassingly slow

Niels Möller nisse at lysator.liu.se
Fri Apr 20 11:20:34 UTC 2018


Fredrik Johansson <fredrik.johansson at gmail.com> writes:

> It would be possible to have mpn_mul itself assembly-coded to do something
> like this:
>
> case 1x1: ...
> case 2x1: ...
> case 2x2: ...
> generic case, small n: (basecase loop)
> generic case, large n: (fall back to calling an mpn_mul_generic function
> that selects between different algorithms)

Interesting idea! It's backwards to how assembly code is currently
organized, as far as I'm aware we have no cases of assembly routines
calling (or jumping to, as would be the case here) complex C code.

Such an assembly routine would need access to the threshold between
basecase and generic, which in the case of fat builds isn't a compile
time constant. 

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