labels in extended asm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux