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]

FW: Inline Assembler for PPC


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)".

I have tried many, many other things but none of them even compile. Maybe it is not possible.

I am using gcc 3.3 for mac.

Martin

> -----Original Message-----
> From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org]On
> Behalf Of Ian Lance Taylor
> Sent: 22 December 2004 16:04
> To: Martin Payne
> Cc: gcc-help@gcc.gnu.org
> Subject: Re: Inline Assembler for PPC
> 
> 
> "Martin Payne" <martin@microcosm.co.uk> writes:
> 
> > All I would like to do is to store the value of a C function I 
> have just called into a C variable called "i".
> > 
> > So instead of doing:
> > 
> > i = myfunction();
> > 
> > I want to do something like this:
> > 
> > myfunction();
> > stw r3, i
> > 
> > (I know the value of the function is stored into the r3 register.)
> > 
> > It might look odd but I have my reasons for doing this. 
> However, for everything I try with the keyword "asm" for inline 
> assembler, it doesn't compile.
> > 
> > All I want to do is put the value in register r3 into my C variable, i.
> > 
> > Any ideas?
> 
> Read
>     
http://gcc.gnu.org/onlinedocs/gcc-3.4.3/gcc/Extended-Asm.html#Extended-Asm

If you have tried that already, then tell us what you did, and in what
way it did not work.

Ian

---

Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.766 / Virus Database: 513 - Release Date: 17/09/2004

---

Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.766 / Virus Database: 513 - Release Date: 17/09/2004

---

Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.766 / Virus Database: 513 - Release Date: 17/09/2004


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