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:

> 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


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