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.
From: Andreas Schwab <hidden> Date: 2007-01-13 13:20:25
yuraxa [off-list ref] 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."
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.
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.
From: Paul Mackerras <hidden> Date: 2007-01-13 23:48:01
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.