[PATCH 2/2] Optimize 64-bit mpn_add_N and mpn_sub_N for sparc T3 and later.

Niels Möller nisse at lysator.liu.se
Thu Mar 7 15:07:45 CET 2013


Torbjorn Granlund <tg at gmplib.org> writes:

> There are no 64-bit subtraction instruction that take a useful
> carry-in.

> More recently, as part of a special "visual instruction set 3", Oracle
> added 64-bit addition instructions which take a useful carry-in...

And one can use the 64-bit add-with-carry to do a subtraction chain, at
the cost of complementing the operand to be subtracted (and using an
initial input carry of one rather than zero). But maybe that trick
doesn't fit well with submul_1 (it would work better for a B - C...)

Ah, now I see that David is using that trick for his mpn_sub_n loop (at
a cost of 1 c/l on T3 and 0.5 c/l on T4), so that was probably the
context for the previous discussion in December.

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