<div class="gmail_quote">On Fri, Sep 30, 2011 at 12:41 AM, Nick Lewycky <span dir="ltr"><<a href="mailto:nicholas@mxc.ca">nicholas@mxc.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5">Kaelyn Uhrain wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
In X86AsmPrinter::<u></u>printLeaMemReference, immediate displacements for<br>
memory references currently are not being emitted if the memory<br>
reference has parentheses and the displacement is zero. This breaks<br>
inline assembly code that adds a constant to the displacement, e.g.:<br>
"leal 128+%0, %%edx" where %0 is a memory reference. Currently the<br>
emitted code would look like "leal 128+(%esp)" which triggers a warning<br>
(that an operand is missing and zero is being assumed) with GNU as and<br>
is not accepted at all by llvm-mc. With this patch "leal 128+0(%esp)" is<br>
emitted, which is happily accepted by both gas and llvm-mc.<br>
</blockquote>
<br></div></div>
Thanks for writing this! :)<br>
<br>
+; Make sure we generate acceptable memory references for things like (in C):<br>
+;    void test8(char *tmp) {<br>
+;        __asm__ volatile(<br>
+;    " leal 128+%0,%%edx\n\t"<br>
+;      :<br>
+;      :"m"(tmp)<br>
+;      :"memory","%edx");<br>
+;    }<br>
+; CHECK: leal 128+0(%esp),%edx<br>
+define void @test8(i8* %tmp) nounwind {<br>
<br>
Also add "+; CHECK: test8" first, to make it clear that we can't match any leal earlier in the file.<br></blockquote><div><br></div><div>Will do! Thanks. :)</div><div><br></div><div> - Kaelyn</div></div>