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: FW: Inline Assembler for PPC


"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


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