<div dir="ltr">On Wed, Jun 5, 2013 at 2:50 PM, Brett Hale <span dir="ltr"><<a href="mailto:brettyhale@gmail.com" target="_blank">brettyhale@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I recently submitted this question to <a href="http://stackoverflow.com/questions/16850309/clang-llvm-inline-assembly-multiple-constraints-with-useless-spills-reload" target="_blank">stackoverflow</a>, but it might need the attention of someone more familiar with clang / llvm internals.<div>


I am using <b>Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)</b>.</div><div><br></div><div>Inline assembly for a 64 x 64 = 128 bit (x86-64) multiply:</div><div><br></div><div><b>__asm__ ("mulq %q3" : "=a" (rl), "=d" (rh) : "%0" (x), "rm" (y) : "cc")</b></div>


<div><br></div><div>yields:</div><div><br></div><div><div><b>movq    %rcx, -8(%rbp)</b></div><div><b>## InlineAsm Start</b></div><div><b>mulq -8(%rbp)</b></div><div><b>## InlineAsm End</b></div><div>
<br></div><div>which stores and reloads the value. <b>"r" (y)</b> appears to correct this, yielding: <b>mulq %rcx</b>, but at the loss of the range of valid constraints, which could be an issue in the event of register pressure. The optimization level does not seem to affect the result. Furthermore, multiple alternative constraint syntax, such as: <b>"r,m" (y)</b>, appears to work, but simply ignores alternatives after the first, as evidenced by: <b>"m,r" (y)</b>. Have these issues been resolved or under consideration in current revisions?</div>

</div></div></blockquote><div><br></div><div>LLVM currently always spills "rm" constraints in order to simplify the handling of inline asm in the backend (you can ask on llvmdev if you want details).  I don't know of any plans to fix this in the near future.</div>

<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>I apologize for the bold-type, hyperlinks, etc., in advance. I'm not sure of the posting etiquette. The original stackoverflow question is more concise.</div>

</div></div></blockquote><div><br></div><div>We care more that you're asking a well-formed question than the details of how it's formatted. :)</div><div><br></div><div>-Eli </div></div><br></div></div>