Re: Register + Offset vs. Register Indirect

igor!davidm@uunet.UU.NET (David Moore)
Mon, 8 Jun 1992 17:45:33 GMT

          From comp.compilers

Related articles
Caller allocates space for callee-save registers pardo@cs.washington.edu (1992-05-21)
Register + Offset vs. Register Indirect eifrig@beanworld.cs.jhu.edu (1992-06-07)
Re: Register + Offset vs. Register Indirect igor!davidm@uunet.UU.NET (1992-06-08)
Re: Register + Offset vs. Register Indirect db@dcs.ed.ac.uk (Dave Berry) (1992-06-09)
| List of all articles for this month |

Newsgroups: comp.compilers
From: igor!davidm@uunet.UU.NET (David Moore)
Keywords: architecture, registers
Organization: Compilers Central
References: 92-05-123 92-06-032
Date: Mon, 8 Jun 1992 17:45:33 GMT

eifrig@beanworld.cs.jhu.edu (Jonathan Eifrig) writes:
> The biggest advantage of the (register + short immediate)
>addressing mode is that the _loading_ of the offset is essentially free.
>Since (if my memory is serving me) something like half of all memory
>references (of compiled C programs) use the (stack-pointer + offset)
>addressing mode, the advantage of the free load usually offsets the
>penalty of the possible pipeline stall.


The chief advantage of register+short immediate addressing is to avoid
having to increment large numbers of induction variables in loops. On the
AM29000, every address produces a separate induction variable.


On a machine like the Sparc with a small register window, having to do
this would be catastrophic to loop performance. On the 29000 familly, you
have plenty of registers, so that running out of registers for all these
induction variables is not a problem. On the other hand, you have to
explicitly increment them. My 29000 Fortran compiler makes some effort to
hide these increments in the dead time after loads/stores so that most of
them happen "for free". If you don't do this, you end up with a pile of
adds at the end of every loop. (unless, of course, you have a very good
instruction scheduler which can schedule across basic blocks)


There is no load overhead for short offsets. The 29000 has add and
subtract immediate (and a subtract reverse immediate) instructions which
allow offsets in the range -256..255 to be added directly.


David Moore.
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.