RE: FW: Inline Assembler for PPC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Thanks for showing an interest.

> -----Original Message-----
> From: gcc-help-owner@xxxxxxxxxxx [mailto:gcc-help-owner@xxxxxxxxxxx]On
> Behalf Of Ian Lance Taylor
> Sent: 22 December 2004 16:26
> To: Martin Payne
> Cc: gcc-help@xxxxxxxxxxx
> Subject: Re: 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)".
> 
> First, there is no need to put "r3" in the list of clobbered
> registers, as your instruction does not clobber r3.
> 
> Second, please send a complete example.  I tried this, and it appeared
> to work fine.
> 
> int foo (int i)
> {
>   asm ("stw %%r3, %0" : : "r" (i));
> }
> 
> 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



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux