# Shared toom evaluation functions

Torbjorn Granlund tg at gmplib.org
Mon Nov 16 00:04:59 CET 2009

bodrato at mail.dm.unipi.it writes:

Ciao,

>   > We should use mpn_addlsh1_n in more places I think, even for the s,t
>   > related computations, such as pm2 in toom72.  That will be a bit

>   All evaluations in \pm2 and \pm1/2 for operands split in two should
> better use the simple trick:
>   b0 + 2*b1 = (b0 + b1) + b1

> I think we do that already, at least on some of the toom files.

Yes, we do. I mean, where we don't we should avoid addlsh1 anyway.

> And if we want to continue adding assembly primitives, we could of
> course do the above much faster using one single loop, doing two reads

I'm not able to write in assembler... but I can propose to use an assembly
function already written and never used :-D

I forgot to say: Please test that on sopme x86_64 machine (make && make
check) shoudl do it, and then commit it!

I checked in a aorrlsh2_n for x86_64.  It runs at 2.5 c/l on AMD K8-K10
and 3.0 c/l on Core 2 and i7.

You said it was useful.  Now use it.  :-)

(I was lazy and did not define the rsblsh1_n return value.  If you need
it, we can fix that.)

--
Torbjörn