title: When to use a particular operand constraint in extended GCC inline assembly?
body: <p>I'm having a hard time understanding when to use a particular input operand constraint over another in extended GCC inline assembly.</p>
  
  <p>For example:</p>
  
  <pre><code>int x = 42;
  asm("movl %0, %%eax;"
      : /* no outputs */
      : "r"(x)
      : "%eax");
  </code></pre>
  
  <p>I know that <code>"r"</code> tells the compiler to use a register hold the value of <code>x</code>, but when would it be more appropriate to use <code>"g"</code> or <code>"m"</code>? Would using <code>"m"</code> break this code since I'm using a register destination; and would <code>"g"</code> be too "vague" of an operand constraint?</p>