This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Assigning registers to variables in inlines
- To: "Timothy J. Wood" <tjw at omnigroup dot com>
- Subject: Re: Assigning registers to variables in inlines
- From: Jeffrey A Law <law at redhat dot com>
- Date: Tue, 09 Jan 2001 18:25:44 -0700
- cc: gcc at gcc dot gnu dot org
- Reply-To: law at redhat dot com
In message <200101100115.RAA06777@scyther.omnigroup.com>you write:
>
> So, I'd like some way to say "don't put offset in r0". Any other
> register is OK. The following fails, though:
>
> static inline unsigned int __lwbrx(register void *addr, register int
> offset) {
> register unsigned int word;
> register unsigned int asm("r9") _offset = offset;
>
> asm("lwbrx %0,%2,%1" : "=r" (word) : "r" (addr), "r" (_offset));
> return word;
> }
Try:
static inline unsigned int __lwbrx(register void *addr, register int
offset) {
register unsigned int word;
asm("lwbrx %0,%2,%1" : "=r" (word) : "r" (addr), "b" (offset));
return word;
}
[ Note the different constraint in the asm for the offset variable. ]
jef