This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Special instructions in inline assembler
- From: Falk Hueffner <falk dot hueffner at student dot uni-tuebingen dot de>
- To: Derek Roberts <derek at camroberts dot org dot uk>
- Cc: gcc-help at gcc dot gnu dot org
- Date: 16 Dec 2003 00:51:37 +0100
- Subject: Re: Special instructions in inline assembler
- References: <5.1.0.14.0.20031212175837.0237d830@pop.ntlworld.com>
Derek Roberts <derek@camroberts.org.uk> writes:
> When I use the special instruction, I load or store two 32-bit
> registers from or to adjacent dwords in memory. The catch is this:
> the register named in the instruction must be even (i.e. r0, r2, r4
> etc) and the second register that gets "clobbered" is related to the
> first by a fixed increment of one.
>
> My question is this:
> Is it possible to write this instruction in inline assembler ? I can't
> seem to find a constraint that works. Currently I'm using r2 and r3,
> declaring them as clobbered and doing a copy to the registers that C
> supplied. This is nearly as inefficient as doing the two dword loads.
You can declare two fixed registers with something like
register uint32_t r2 asm("r2");
register uint32_t r3 asm("r3");
and use them. Of course this will not be as efficient as if the
compiler were to chose them itself, but at least you need no copying.
--
Falk