Best way to carry on 2-input architecture?

Niels Möller nisse at lysator.liu.se
Sun Aug 17 20:33:45 UTC 2014


"Wesley W. Terpstra" <wesley at terpstra.ca> writes:

>> For multiply, d = (a * b + c) mod B (B being the word base) and d = [(a
>> * b + c) / B] are very useful.
>
> I see the benefit to the mulhadd variant (=> no hardware division).
> I'm not convinced by the mulladd variant.

Interesting, I hadn't thought about this lack of symmetry (i.e., the hi variant
is beneficial, lo variant provides little gain compared to using umullo
and add).

Maybe an instruction for floor [(a + b + c)/B] could make some sense for
similar reasons, as a generalization of add with carry. In the add loop,
one operand would be the input carry, restricted to 0 or 1, and it
produces the output carry with a single instruction. IIRC, Torbjörn's
ISA has an instruction for that special case.

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