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: 24 Dec 2004 09:46:27 -0500
- Subject: Re: FW: Inline Assembler for PPC
- References: <000001c4e99c$01c73920$0401a8c0@martin>
"Martin Payne" <martin@microcosm.co.uk> writes:
> So, it is impossible to get the value of r3 into a local variable?
No. It's just wrong to use stw with an "r" constraint. The "r"
constraint means that the value needs to be in a register. That's
fine, but using it with stw is not fine.
For example, try this:
asm ("mr %0,3" : "=r" (i) : );
Note that since the value is to be stored into the local variable i,
it is an output operand. I've put it in the list of output operands,
and I've added the "=" constraint which is required for all output
operands.
Ian