Related articles |
---|
[3 earlier articles] |
Re: Compiler optimization of division and remainder richard@atheist.tamu.edu (1996-01-28) |
Re: Compiler optimization of division and remainder prener@watson.ibm.com (1996-01-29) |
Re: Compiler optimization of division and remainder hbaker@netcom.com (1996-01-29) |
Re: Compiler optimization of division and remainder Peter-Lawrence.Montgomery@cwi.nl (1996-01-29) |
Re: Compiler optimization of division and remainder johnmce@world.std.com (1996-01-29) |
Re: Compiler optimization of division and remainder michael.williams@armltd.co.uk (1996-01-29) |
Re: Compiler optimization of division and remainder jgj@ssd.hcsc.com (1996-01-29) |
Re: Compiler optimization of division and remainder dave@occl-cam.demon.co.uk (Dave Lloyd) (1996-01-29) |
Re: Compiler optimization of division and remainder dave@occl-cam.demon.co.uk (Dave Lloyd) (1996-02-02) |
From: | jgj@ssd.hcsc.com (Jeff Jackson) |
Newsgroups: | comp.compilers |
Date: | 29 Jan 1996 17:48:21 -0500 |
Organization: | I would rather be windsurfing. |
References: | 96-01-088 |
Keywords: | optimize, arithmetic |
> On another newsgroup, a poster claimed that some compilers could
> optimize a program which used both a/b and a%b (both quotient and
> remainder with the _same_ arguments) in such a way that the compiler
> would perform only a single hardware division operation and arrange to
> use both the quotient and remainder from this single operation.
Our compilers here at Harris Computer Systems Corporation do this. On
the PowerPC, we just expand the 'mod' operator in our trees into the
low level operations, including a divide, to do it. CSE elimination
should then pick up the divides and do them only once.
On previous architectures, where a single instruction gave both the
quotient and the remainder, we expanded both the divide and mod
operator into extract_quotient and extract_remainder operators of a
divmod operator.
Peter-Lawrence.Montgomery@cwi.nl (Peter L. Montgomery) suggests a
similar thing for comparisons. We get that one too with a method like
the divmod method described above.
--
Jeffrey Glen Jackson
jgj@ssd.csd.harris.com
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.