linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* ppc inline asm syntax
@ 2007-01-13 11:41 yuraxa
  2007-01-13 13:20 ` Andreas Schwab
  0 siblings, 1 reply; 5+ messages in thread
From: yuraxa @ 2007-01-13 11:41 UTC (permalink / raw)
  To: linuxppc-dev

Hi, i'm writing some inline assembly for ppc.
Grepping linux src code for examples i found syntax that i can't
understand, but as i can see it's frequently used.  For example:

__asm__ __volatile__("lwz%U1%X1 %0,%1;\n"
                              "twi 0,%0,0;\n"
                              "isync" : "=r" (ret) : "m" (*addr));

Can you explain me please  howto interpret 'lwz%U1%X1'  format string
in the assembler template line? Some other of them are:

'stw%U0%X0'   etc...

I can't find any help on this topic on the web.

Thanks a'lot,
Yury.

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

* Re: ppc inline asm syntax
  2007-01-13 11:41 ppc inline asm syntax yuraxa
@ 2007-01-13 13:20 ` Andreas Schwab
  2007-01-13 18:28   ` yuraxa
  0 siblings, 1 reply; 5+ messages in thread
From: Andreas Schwab @ 2007-01-13 13:20 UTC (permalink / raw)
  To: yuraxa; +Cc: linuxppc-dev

yuraxa <ygeorgie@gmail.com> writes:

> Hi, i'm writing some inline assembly for ppc.
> Grepping linux src code for examples i found syntax that i can't
> understand, but as i can see it's frequently used.

There is some documentation in the GCC internals manual, see
<http://gcc.gnu.org/onlinedocs/gccint/Output-Template.html>.  The ppc
specific operand modifiers are only documented in the GCC source, see
print_operand in
<http://gcc.gnu.org/viewcvs/trunk/gcc/config/rs6000/rs6000.c?view=markup>.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: ppc inline asm syntax
  2007-01-13 13:20 ` Andreas Schwab
@ 2007-01-13 18:28   ` yuraxa
  2007-01-13 23:09     ` Alan Modra
  2007-01-13 23:48     ` Paul Mackerras
  0 siblings, 2 replies; 5+ messages in thread
From: yuraxa @ 2007-01-13 18:28 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: linuxppc-dev

> > Hi, i'm writing some inline assembly for ppc.
> > Grepping linux src code for examples i found syntax that i can't
> > understand, but as i can see it's frequently used.
>
> There is some documentation in the GCC internals manual, see
> <http://gcc.gnu.org/onlinedocs/gccint/Output-Template.html>.  The ppc
> specific operand modifiers are only documented in the GCC source, see
> print_operand in
> <http://gcc.gnu.org/viewcvs/trunk/gcc/config/rs6000/rs6000.c?view=markup>.
>
> Andreas.
>

Thanks a'lot, It helps! But may be you'll be so graceful to explain
more precisely?
I don't quite understand how the final string will look like...
For 'U' operand modifier the comment is:
/* Print `u' if this has an auto-increment or auto-decrement.  */
But for 'X' operand modifier there is no comment at all.

Thanks in advance,
Yury.

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

* Re: ppc inline asm syntax
  2007-01-13 18:28   ` yuraxa
@ 2007-01-13 23:09     ` Alan Modra
  2007-01-13 23:48     ` Paul Mackerras
  1 sibling, 0 replies; 5+ messages in thread
From: Alan Modra @ 2007-01-13 23:09 UTC (permalink / raw)
  To: yuraxa; +Cc: linuxppc-dev

On Sat, Jan 13, 2007 at 07:28:39PM +0100, yuraxa wrote:
> But for 'X' operand modifier there is no comment at all.

Are you afraid to look at code?  Three lines!  It prints an 'x' if the
operand is an indexed address.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

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

* Re: ppc inline asm syntax
  2007-01-13 18:28   ` yuraxa
  2007-01-13 23:09     ` Alan Modra
@ 2007-01-13 23:48     ` Paul Mackerras
  1 sibling, 0 replies; 5+ messages in thread
From: Paul Mackerras @ 2007-01-13 23:48 UTC (permalink / raw)
  To: yuraxa; +Cc: linuxppc-dev

yuraxa writes:

> Thanks a'lot, It helps! But may be you'll be so graceful to explain
> more precisely?
> I don't quite understand how the final string will look like...
> For 'U' operand modifier the comment is:
> /* Print `u' if this has an auto-increment or auto-decrement.  */
> But for 'X' operand modifier there is no comment at all.

'X' turns into "x" if gcc wants to use indexed addressing mode, or
nothing if gcc wants to use base + offset mode.

I agree that the gcc documentation of the details of inline assembly
for each specific architecture is woeful.  I have found it useful in
the past to get hold of the gcc source code and look in rs6000.md for
examples of what can be done.

Paul.

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

end of thread, other threads:[~2007-01-13 23:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-13 11:41 ppc inline asm syntax yuraxa
2007-01-13 13:20 ` Andreas Schwab
2007-01-13 18:28   ` yuraxa
2007-01-13 23:09     ` Alan Modra
2007-01-13 23:48     ` Paul Mackerras

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 NNTP newsgroup(s).