title: I need help converting Intel inline asm to AT&T so I can compile it with gcc
body: <p>This is the original code:</p>
  
  <pre><code>#define CPU_PREFETCH(cache_line)            \
  { int* address = (int*) (cache_line);       \
      _asm mov edx, address                   \
      _asm prefetcht0[edx]                    \
  }
  
  #define CPU_GET_CYCLES(low)                 \
  {                                           \
      _asm    rdtsc                           \
      _asm    mov dword ptr [low], eax        \
  }
  
  #define CPU_SYNC                            \
  {                                           \
      _asm    mov eax, 0                      \
      _asm    cpuid                           \
  }
  
  #define CPU_CACHE_FLUSH(cache_line)         \
  { int* address = (int*) (cache_line);       \
      _asm mov edx, address                   \
      _asm clflush[edx]                       \
      _asm mfence                             \
  }
  </code></pre>
  
  <p>Thanks to Jester, I now have this:</p>
  
  <pre><code>#define CPU_PREFETCH(cache_line) \
  { \
      __asm__ __volatile__ ("prefetcht0 %0" : : "m" (*(int*)cache_line)); \
  }
  
  #define CPU_GET_CYCLES(low) \
  { \
      __asm__ __volatile__ ("rdtsc" : "=a" (low) : : "%edx"); \
  }
  
  #define CPU_SYNC \
  { \
      __asm__ __volatile__ ("cpuid" : : : "%eax", "%ebx", "%ecx", "%edx"); \
  }
  
  #define CPU_CACHE_FLUSH(cache_line) \
  { \
      __asm__ ("clflush %0; mfence" : : "m" (*(int*)cache_line)); \
  }
  </code></pre>
  
  <p>Evidently, gcc doesn't like <strong>volatile</strong> with clflush.
  Thanks everyone.    </p>
  
  <p>I am trying to compile <a href="http://sourceforge.net/projects/slicing-by-8/" rel="nofollow">Slicing-By-8</a> with gcc as a dll so I can use it in my VB6 app.</p>