This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
labels in extended asm
- From: Adam Reid <areid at lumerical dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Tue, 24 Jan 2006 17:12:36 -0800
- Subject: labels in extended asm
Hi,
I am wondering if someone can show me an example of how to use local labels in
extended asm? I would like to be able to put a line of extended asm into an
inline function without having the labels duplicated each time the function is
inlined by the compiler. I have heard that this is possible using the "%ldigit"
feature of the output templates, but I can't figure out how to use this feature.
The following is an example of the type of function I'd like to write:
inline void memcopy(int *A, int *B, int len){
asm volatile("shl $2, %%ecx;\n\t"
"xorl %%edx, %%edx;\n"
"myloop:\n\t"
"movl (%%eax, %%edx), %%esi;\n\t"
"movl %%esi, (%%ebx, %%edx);\n\t"
"addl $4, %%edx;\n\t"
"cmpl %%ecx, %%edx;\n\t"
"jl myloop;"
:
:"c" (len), "a" (A), "b" (B)
:"edx", "esi", "memory"
);
return();
}
Thanks for your help,
Adam