public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Inline Assembler for PPC
@ 2004-12-22 15:38 Martin Payne
  2004-12-22 16:04 ` Ian Lance Taylor
  0 siblings, 1 reply; 2+ messages in thread
From: Martin Payne @ 2004-12-22 15:38 UTC (permalink / raw)
  To: gcc-help

I am trying to do some very simple inline assembler with GCC, compiling on the Mac (MACOSX).

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?

---

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Inline Assembler for PPC
  2004-12-22 15:38 Inline Assembler for PPC Martin Payne
@ 2004-12-22 16:04 ` Ian Lance Taylor
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 2004-12-22 16:04 UTC (permalink / raw)
  To: Martin Payne; +Cc: gcc-help

"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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-12-22 16:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-22 15:38 Inline Assembler for PPC Martin Payne
2004-12-22 16:04 ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).