title: Set register using a variable inline assembly
body: <p>My requirement is to set EDI register using a variable with inline assembly. I wrote the following snippet but it fails to compile.</p>
  
  <pre><code>uint32_t value = 0;
  __asm__ __volatile__("mov %1,%%edi \n\t"
                        : "=D"
                        : "ir"  (value)
                        :
                        );
  </code></pre>
  
  <p>Errors I get are </p>
  
  <blockquote>
    <p>cyg_functions.cpp(544): error: expected a "("
                                : "ir"  (value)
                                ^</p>
    
    <p>cyg_functions.cpp(544): internal error: null pointer
                                : "ir"  (value)</p>
  </blockquote>
  
  <p><strong>Edit</strong></p>
  
  <p>I guess I wasn't clear on the problem specification. Let's say my requirement is as follows.</p>
  
  <ul>
  <li>There are two int variables val and result.</li>
  <li>I need to
  <ol>
  <li>Set the value of variable val to %%edi clobbering whatever in there already</li>
  <li>Multiply %%edi value by 2</li>
  <li>Set %%edi value back to result variable</li>
  </ol></li>
  </ul>
  
  <p>How can this be stated with inline assembly? Though this is not exactly my requirement answer to this (specifically the 1st step) would solve my problem. I need the intermediate to be specifically in EDI register. </p>