div_qr_1 interface
Niels Möller
nisse at lysator.liu.se
Tue Oct 22 16:41:28 CEST 2013
Torbjorn Granlund <tg at gmplib.org> writes:
> But I lack unit testing code for the function, making hacking quite
> cumbersome. I don't feel safe hacking *any* GMP assembly code without
> tests/devel/try.c's function and access checks.
tests/mpn/t-div.c includes tests for mpn_div_qr_1, including single
guard limbs before and after the q area. That provides for some
reasonable testing, and I was running while GMP_CHECK_RANDOMIZE=0
./t-div ; : ; done over night in the weekend.
But sure, support also in try.c would be good.
> (1) Shorten a dep chain, and avoid keeping CF live over an inc
> instruction. The cmov doesn't really depend on sbb, since the
> latter insn never really changes carry. (This might btw be useful
> to teach loppmixer!)
Right, using cmov (instead of masking) allows some more reordering.
> (2) Reallocate Q2 to an "old" register (not r8-r15) and then use the
> 32-bit form of "adc $0,reg". That form is shorter.
Clever!
> (3) Offet UP to avoid the offset in the loop.
Should be straight forward. Or one could offset UN, but I think it's
nice to be able to use dec / jnz for the loop. Or is the obscure "loop"
decrement and branch instruction useful?
Regards,
/Niels
--
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.
More information about the gmp-devel
mailing list