fixed-size mpn_mul_n for small n?

Torbjorn Granlund tg at gmplib.org
Sun Feb 12 18:10:01 CET 2012


Zimmermann Paul <Paul.Zimmermann at loria.fr> writes:

  GMP currently has variable-size assembly code for mpn_mul_n on some
  processors. Could it be faster to have fixed-size assembly code for
  small values of n (say up to n=32)? Then mpn_mul_n() would simply be
  a wrapper to those fixed-size functions, or to a variable-size code
  for n>32.
  
There are assembly mpn_mul_basecase for a lot of machines.  Some of
these offer special code for certain small un,vn.  This gives two
benefits: (1) less overhead for small sizes amd (2) simpler general
code.

Providing special code for many un,vn combinations (as separate
functions are as part of mpn_mul_basecase) quickly become unmanageable.
If we want to handle all sizes <= 16 (say) we'll need 136 variants.

I don't think it makes much sense providing code for just un=vn (except
that it becomes more manageable...).

-- 
Torbjörn


More information about the gmp-devel mailing list