|Is there a way of generating code for x/const without division? email@example.com (1992-04-02)|
|Re: Is there a way of generating code for x/const without division? firstname.lastname@example.org (1992-04-03)|
|Re: Is there a way of generating code for x/const without division? email@example.com (1992-04-03)|
|Re: Is there a way of generating code for x/const without division? firstname.lastname@example.org (1992-04-08)|
|Re: Is there a way of generating code for x/const without division? email@example.com (1992-04-07)|
|From:||firstname.lastname@example.org (Ramsey Haddad)|
|Organization:||DEC Western Research Lab, Palo Alto, CA|
|Date:||Tue, 7 Apr 1992 23:22:56 GMT|
In article 92-04-026 email@example.com (Eliot Moss) writes:
>The question was: if one is dividing by a constant or taking modulus by a
>constant, might one do better than using a general divid instruction,
>analogous to doing some shifts and adds to replace a multiply?
>Basically, one replaces the division by multiplication times the inverse.
>Perhaps other respondents can provide citations in the literature
Robert Alverson. "Integer division using reciprocals", in 10th IEEE
Symposium on Computer Arithemtic, pages 186-190, June 1991. IEEE pub code
The paper discusses the approach followed by Tera Computers. It covers all
divisions, with division by constants outlined as a special case.
For signed division by constants on a DEC Alpha, you can use the method
outlined in his paper. For unsigned division, Tera uses some extra
hardware support that is also useful for general divisions. Since this
extra hardware support is not in the specification for the DEC Alpha, some
other method must be used. If you want the details, send me email.
Ramsey Haddad <firstname.lastname@example.org>
[Similar notes from Tim Peters <email@example.com>, and from Bob Alverson himself
Return to the
Search the comp.compilers archives again.