title: gcc inline assembly error "operand type mismatch for mov"
body: <pre><code>//quick inline asm statements performing the swap_byte for key_scheduling
  inline void swap_byte(unsigned char *x, unsigned char *y)
  {
   unsigned char t;
   asm("movl %1, %%eax;"
       "movl %%eax, %0;"
       :"=r"(t)
       :"r"(*x)
       :"%eax");
   asm("movl %1, %%eax;"
       "movl %%eax, %0;"
       :"=r"(*x)
       :"r"(*y)
       :"%eax");
   asm("movl %1, %%eax;"
       "movl %%eax, %0;"
       :"=r"(*y)
       :"r"(t)
       :"%eax");       
  }
  </code></pre>
  
  <p>Here I am trying to swap the char from <code>x</code> and store in <code>y</code>, and the same for <code>y</code> to <code>x</code>.
  I have compiled these instructions by changing <code>movl</code> to <code>mov</code> but with no success. Where is the problem in compiling/linking?</p>
  
  <p>Here is the output from compiling in cygwin:</p>
  
  <pre><code>$ gcc rc4_main.c -o rc4ex
  /tmp/ccy0wo6H.s: Assembler messages:
  /tmp/ccy0wo6H.s:18: Error: operand type mismatch for `mov'
  /tmp/ccy0wo6H.s:18: Error: operand type mismatch for `mov'
  /tmp/ccy0wo6H.s:26: Error: operand type mismatch for `mov'
  /tmp/ccy0wo6H.s:26: Error: operand type mismatch for `mov'
  /tmp/ccy0wo6H.s:34: Error: operand type mismatch for `mov'
  /tmp/ccy0wo6H.s:34: Error: operand type mismatch for `mov'
  </code></pre>