Organization of multiplication functions

Torbjorn Granlund tege at swox.com
Sun Sep 14 13:18:55 CEST 2003


Does anybody understand the reason for why mpn_sqr_n lives in mul.c
while mpn_mul_n lives in mul_n.c?

The rule "one function one file" allows for perfect incremental
linking.  I.e., only the function actually used will end up in
(statically linked) binaries.

But some machines, most notably vector machines, have huge
calling overhead and therefore want to inline aggressively.  Only
functions in the scope of the compiler (in the same file or in
included files) can get inlined.

To accomodate vector machines, we might want to put mpn_mul_n,
mpn_sqr_n, mpn_mul, and the various karatsuba and toom routines
in a single file.  Or, we might want to move mpn_sqr_n to
mul_n.c.

Any informed opinions?

--
Torbjörn


More information about the gmp-devel mailing list