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: "Martin Payne" <martin at microcosm dot co dot uk>
- To: "Ian Lance Taylor" <ian at airs dot com>
- Cc: <gcc-help at gcc dot gnu dot org>
- Date: Fri, 24 Dec 2004 09:36:12 -0000
- Subject: RE: FW: Inline Assembler for PPC
So, it is impossible to get the value of r3 into a local variable?
> -----Original Message-----
> From: Ian Lance Taylor [mailto:ian@airs.com]
> Sent: 22 December 2004 20:44
> To: Martin Payne
> Cc: gcc-help@gcc.gnu.org
> Subject: Re: FW: Inline Assembler for PPC
>
>
> "Martin Payne" <martin@microcosm.co.uk> writes:
>
> > Well, that same code does not work for me.
> > If I have this code:
> >
> > main(int argc, char* argv[]) {
> > int i;
> > asm("stw %%r3, %0" : : "r" (i));
> >
> > return 0;
> > }
> >
> > and compile it by running:
> >
> > gcc mytest.c
> >
> > it gives the following output:
> >
> > /var/tmp//ccOB6jdo.s:16:Parameter syntax error (parameter 1)
> >
> > I am using gcc 3.3 20030304 by Apple, build 1666.
>
> OK, that error is coming from the assembler, not the compiler. Note
> that the file name is the .s file, not the .c file.
>
> First I'll note that the error message is not from the mainline GNU
> assembler. My understanding is that Apple uses an assembler based on
> very very old version of the GNU assembler. I don't have access to
> any Apple development systems.
>
> That said, the above C source code will generate something like this
> in the assembler file (you can check yourself by using the
> --save-temps option to get the assembler file):
> stw %r3, 3
> That of course won't work. The stw instruction doesn't expect the
> second parameter to be a register.
>
> 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