This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]