mpn_sqrtrem{1,2} - patch for pure C implem

Marco Bodrato bodrato at mail.dm.unipi.it
Sat Apr 1 16:15:48 UTC 2017


Ciao,

Il Mer, 29 Marzo 2017 8:38 am, Adrien Prost-Boucle ha scritto:
> On Wed, 2017-03-29 at 02:06 +0200, Marco Bodrato wrote:
>> You didn't try
>> ./configure ABI=32 && make && make check
>> did you?

> Standard copy/paste problem...
> Just replace vsh by a0 for now, I'll test ABI=32 when possible.

Sorry, but even correcting the obvious typos, it doesn't pass the tests.

On the other side, I tested the proposed sqrtrem1 for ABI=64 on shell (

Before the patch:
$ (cd tests/devel; make sqrtrem_1_2)&&time tests/devel/sqrtrem_1_2 c
Corner cases tested, up to bits:
\ 63
Values of a single limb, tested.

user	1m56.807s

After the patch:
$ (cd tests/devel; make sqrtrem_1_2)&&time tests/devel/sqrtrem_1_2 c
Corner cases tested, up to bits:
\ 63
Values of a single limb, tested.

user	1m47.889s

The code passed the test with an overall 8% gain in speed.

May I suggest to save one more operation with:

invroot = invroot * (((CNST_LIMB(3) << (GMP_LIMB_BITS-2-9)) -
                     (a0 >> 27) * invroot * invroot));

another 1% can be gained...

Regards,
m

-- 
http://bodrato.it/



More information about the gmp-devel mailing list