Special instructions in inline assembler
Falk Hueffner
falk.hueffner@student.uni-tuebingen.de
Mon Dec 15 23:51:00 GMT 2003
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
More information about the Gcc-help
mailing list