Replacement mpn/generic/mul.c

Torbjorn Granlund tg at
Fri Dec 18 15:39:50 CET 2009

I have worked on a better mpn_mul, and here is a preliminary result.

Changes compared to the code in the repository:

* The cutoff lines in the toomX2 code are now exactly between the ideal lines
  of the surrounding algorithms.  (Is this close-enough to optimal?)

* The toomX3 code now uses a structure similar to the one of toomX2, except
  that it loops longer in the unbalanced case.  The result is that the
  remaining area might have un < vn.

* The toomX3 code is used for the largest non-FFT unbalanced operands.  It
  therefore calls mpn_mul recursively for certain cases.

* The toomX4 code now consists of just a call to toom44_mul.  The looping is

I am very interested in feedback!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: mul.c
Type: application/octet-stream
Size: 9200 bytes
Desc: not available
URL: <>
-------------- next part --------------


More information about the gmp-devel mailing list