Recent changes to mpn_get_str/mpn_set_str
bodrato at mail.dm.unipi.it
Mon Feb 27 06:53:53 UTC 2017
Il Mar, 14 Febbraio 2017 3:10 am, Torbjörn Granlund ha scritto:
> "Marco Bodrato" <bodrato at mail.dm.unipi.it> writes:
> A first attempt is attached.
> It is not specialised for base 10, and it is not faster than
> current code if only a few limbs must be converted, but around
> 10 limbs it should be a gain.
> That's expected, I think.
Well, the graphs on the paper show an earlier gain... but much depend on
the base, on architecture...
Anyway, I attach a second attempt (the full substitute for file
mpn/generic/get_str.c). I specialised code for base==10, refined some
details, and I moved some of the internal logic of mpn_div_q directly into
Now the crossover is around 5 limbs.
The code I extracted from mpn_div_q gave me the following:
if (bkn == 1)
mpn_divrem_1 (y0, 0L, tmp, un + 2, bkh);
else if (bkn == 2)
y0 [un + 1] = mpn_divrem_2 (y0, 0L, tmp, un + 3, bk);
invert_pi1 (dinv, bk[bkn - 1], bk[bkn - 2]);
y0 [un + 1] = mpn_sbpi1_div_q (y0, tmp, un + bkn + 1, bk, bkn,
Are divrem_ the best function we currently have to obtain the quotient
only when we divide by 1 or 2 limbs?
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 20712 bytes
Desc: not available
More information about the gmp-devel