This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: FW: Inline Assembler for PPC
- From: Ian Lance Taylor <ian at airs dot com>
- To: "Martin Payne" <martin at microcosm dot co dot uk>
- Cc: <gcc-help at gcc dot gnu dot org>
- Date: 22 Dec 2004 11:25:58 -0500
- Subject: Re: FW: Inline Assembler for PPC
- References: <003001c4e841$ec6d4980$0401a8c0@martin>
[ I see that you did reply to the mailing list as well--thanks for
doing that--so I am sending my reply here also. ]
> I have read that but it does not tell me how to specify a register in the assembler command.
>
> I want to get the value of r3 into my local C variable: i.
>
> I have tried: asm ("stw %%r3, %0" : : "r" (i) : "r3")
>
> However, that does not compile giving error "parameter syntax error (parameter 1)".
First, there is no need to put "r3" in the list of clobbered
registers, as your instruction does not clobber r3.
Second, please send a complete example. I tried this, and it appeared
to work fine.
int foo (int i)
{
asm ("stw %%r3, %0" : : "r" (i));
}
Ian