Related articles |
---|
Is there a way of generating code for x/const without division? jeremy@sw.oz.au (1992-04-02) |
Re: Is there a way of generating code for x/const without division? suitti@ima.isc.com (1992-04-03) |
Re: Is there a way of generating code for x/const without division? moss@cs.umass.edu (1992-04-03) |
Re: Is there a way of generating code for x/const without division? markt@harlqn.co.uk (1992-04-08) |
Re: Is there a way of generating code for x/const without division? haddad@pa.dec.com (1992-04-07) |
Newsgroups: | comp.compilers |
From: | haddad@pa.dec.com (Ramsey Haddad) |
Keywords: | optimize, arithmetic |
Organization: | DEC Western Research Lab, Palo Alto, CA |
References: | 92-04-018 92-04-026 |
Date: | Tue, 7 Apr 1992 23:22:56 GMT |
In article 92-04-026 moss@cs.umass.edu (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
CH3015-5/91/0000/0186.
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 <haddad@decwrl.dec.com>
[Similar notes from Tim Peters <tim@ksr.com>, and from Bob Alverson himself
<bob@tera.com>. -John]
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.