Efficient long division via Montgomery multiply
Ernst W. Mayer

TL;DR
This paper introduces a new efficient long division algorithm using Montgomery multiplication, optimized for multi-word dividends and large moduli, with significant performance improvements on modern hardware.
Contribution
The paper presents a novel right-to-left long division algorithm based on Montgomery multiply, optimized for large multi-word dividends and efficient hardware implementation.
Findings
Achieved 6 cycles per dividend word for remainder calculation on x86_64.
Achieved 12.5 cycles per dividend word for full division (quotient and remainder).
Introduced a bit-doubling modular inversion scheme for large precision inverse computation.
Abstract
We present a novel right-to-left long division algorithm based on the Montgomery modular multiply, consisting of separate highly efficient loops with simply carry structure for computing first the remainder (x mod q) and then the quotient floor(x/q). These loops are ideally suited for the case where x occupies many more machine words than the divide modulus q, and are strictly linear time in the "bitsize ratio" lg(x)/lg(q). For the paradigmatic performance test of multiword dividend and single 64-bit-word divisor, exploitation of the inherent data-parallelism of the algorithm effectively mitigates the long latency of hardware integer MUL operations, as a result of which we are able to achieve respective costs for remainder-only and full-DIV (remainder and quotient) of 6 and 12.5 cycles per dividend word on the Intel Core 2 implementation of the x86_64 architecture, in single-threaded…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsCryptography and Residue Arithmetic · Coding theory and cryptography · Polynomial and algebraic computation
