1994 · 104 citations · 9 references
ComputingComputer EngineeringComputer ScienceAlgorithmsCompilersComputer ArchitectureArithmetic FunctionsNumber-theoretic AlgorithmsRegister AllocationCompiler DesignDivision AlgorithmsInteger MultiplicationInvariants
Integer division remains expensive on today's processors as the cost of integer multiplication declines. We present code sequences for division by arbitrary nonzero integer constants and run-time invariants using integer multiplication. The algorithms assume a two's complement architecture. Most also require that the upper half of an integer product be quickly accessible. We treat unsigned division, signed division where the quotient rounds towards zero, signed division where the quotient rounds towards -∞, and division where the result is known a priori to be exact. We give some implementation results using the C compiler GCC.
9
An empirical study of FORTRAN programs
Donald E. Knuth · Software Practice and Experience · 1971 · 682 citations
Multiplication by integer constants
Robert Bernstein · Software Practice and Experience · 1986 · 99 citations
Integer multiplication and division on the HP precision architecture
Daniel J. Magenheimer, Liz Peters, Karl Pettis et al. · ACM SIGPLAN Notices · 1987 · 39 citations