<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - inline assembly and =g constraint on output argument"
   href="http://llvm.org/bugs/show_bug.cgi?id=15765">15765</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>inline assembly and =g constraint on output argument
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.2
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>bruce.mitchener@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>In emscripten, we support having JS as "inline assembly" (it makes perfect
sense in context).

With a very simple program:

    double get() {
      double ret = 0;
      __asm __volatile__("12/3.3":"=r"(ret));
      return ret;
    }

    int main() {
      return (int)get();
    }

And compiling it:

    /usr/local/bin/clang -target i386-pc-linux-gnu -emit-llvm -S -o m-r.ll
test.c

the inline asm compiles to:

    %0 = call double asm sideeffect "12/3.3",
"=r,~{dirflag},~{fpsr},~{flags}"() nounwind, !srcloc !0

However, changing it to a =g constraint instead of =r results in this:

    call void asm sideeffect "12/3.3",
"=*imr,~{dirflag},~{fpsr},~{flags}"(double* %ret) nounwind, !srcloc !0

This shows that it isn't picking up the value into ret.

Is =g permissible here or must I use =r?</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>