• Advertisement
Sign in to follow this  

[C++] [GCC] - Inline Assembly

This topic is 3826 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

The following code seems to be considered ilegal in GCC, why?
movb 2(%1, %%ecx), (%0, %%ecx);
Why when i try to compile my program with the following code and the option -O3 the compiler says to me that the symbol bgrLoop was already defined?
    __asm__ __volatile__ (
         "xorl %%ecx, %%ecx;"
         "movb  (%1, %%ecx), %%al;"
         "movb 2(%1, %%ecx), %%ah;"
         "movb %%al, 2(%0, %%ecx);"
         "movb %%ah,  (%0, %%ecx);"
         "addl $3, %%ecx;"
         "decl %2;"
         "jnz bgrLoop;" : "=r" (buffer) : "r" (buffer), "r" (size) : "ah", "al", "ecx");

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement