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

Adrien Prost-Boucle adrien.prost-boucle at
Sun Apr 2 18:56:20 UTC 2017

On Sun, 2017-04-02 at 06:44 +0200, Marco Bodrato wrote:
> For ABI=32, can you please tell us the timings obtained with:
> make&&(cd tests/devel/;make sqrtrem_1_2&&time ./sqrtrem_1_2 x 1)
> before, and after your patch (maybe playing with the different flavours of
> the correction step :-)?

This is what I have on my laptop.
Before my patch (two runs):

real	1m57.290s
real	1m57.692s

With my patch:

real	1m57.597s
real	1m57.550s

So that's really the same time.
Not surprising, because the core code is roughly the same, without the magic constant.
Only the correction code in my patch is simpler.
But with non-random input values, branch prediction absorbs the difference.

Curiously, even with my test program that uses random numbers, there is no clear difference...


More information about the gmp-devel mailing list