This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: ill effect of <register>+<constant>
On Fri, Sep 21, 2007 at 02:19:43PM -0400, Paul Koning wrote:
> >>>>> "Andreas" == Andreas Schwab <schwab@suse.de> writes:
>
> Andreas> "Dave Korn" <dave.korn@artimi.com> writes:
> >> I don't see how removing an unused and non-useful feature would
> >> really count as "crippling". I'm not suggesting it should be
> >> disabled for ppc, but for x86, really .... what could conceivably
> >> be the use?
>
> Andreas> There are many more architectures besides ppc and x86.
> Andreas> Almost all of them have numbered registers.
>
> Sure. The question is: on how many of those do good programmers ever
> do register number arithmetic?
>
> I know of none. I would not want to work with a programmer who did
> such a thing.
The following "good programming" macro for AVR employs this absolutely
essential feature. The address loading is much like PPC's lis & ori, but
here the pointer comprises two registers, necessitating register address
arithmetic.
; Program Pointer initialisation of a register pair.
; Usage: pptr Z,program_address
; icall
.macro pptr reg, addr
ldi \reg, pm_lo8(\addr) ; Does byte_address/2,
ldi \reg + 1, pm_hi8(\addr) ; for use with icall.
.endm
Setting up a 32 bit operand in 4 successive ABI registers would be
another simple case.
The result of such arithmetic is predictable. If the result doesn't
please, then add a different constant? (Now it's probably my turn to not
quite sync with the other perspective? :-)
Erik