Re: GCC inline assembly
- From: "Claudio Daffra" <spamtrap@xxxxxxxxxx>
- Date: 17 Oct 2006 11:58:44 -0700
appreciated.
Thanks,
Mr Linux Guy
http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html#s4
5. Extended Asm.
In basic inline assembly, we had only instructions. In extended
assembly, we can also specify the operands. It allows us to specify the
input registers, output registers and a list of clobbered registers. It
is not mandatory to specify the registers to use, we can leave that
head ache to GCC and that probably fit into GCC's optimization scheme
better. Anyway the basic format is:
asm ( assembler template
: output operands /* optional */
: input operands /* optional */
: list of clobbered registers /* optional */
);
The assembler template consists of assembly instructions. Each operand
is described by an operand-constraint string followed by the C
expression in parentheses. A colon separates the assembler template
from the first output operand and another separates the last output
operand from the first input, if any. Commas separate the operands
within each group. The total number of operands is limited to ten or to
the maximum number of operands in any instruction pattern in the
machine description, whichever is greater.
If there are no output operands but there are input operands, you must
place two consecutive colons surrounding the place where the output
operands would go.
Example:
asm ("cld\n\t"
"rep\n\t"
"stosl"
: /* no output registers */
: "c" (count), "a" (fill_value), "D" (dest)
: "%ecx", "%edi"
);
see above link
regards
claudio daffra
.
- References:
- GCC inline assembly
- From: spamtrap
- GCC inline assembly
- Prev by Date: GCC inline assembly
- Next by Date: Enter multiple values and display them all at once
- Previous by thread: GCC inline assembly
- Next by thread: Re: GCC inline assembly
- Index(es):
Relevant Pages
|