This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Special instructions in inline assembler


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]