<div dir="ltr">This is <a href="http://llvm.org/PR20311">http://llvm.org/PR20311</a>.  IMO a better fix is to use the "=SD" constraint on %1, since ebx isn't really clobbered here.<div><br></div><div>Also, we should probably be checking for PIC defines.</div>
<div><br></div><div>Also, the bug in __cpu_count should be fixed.</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jul 21, 2014 at 3:45 PM, Akira Hatanaka <span dir="ltr"><<a href="mailto:ahatanak@gmail.com" target="_blank">ahatanak@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">The attached patch fixes a bug where the __ebx output is clobbered. Currently, clang generates the following code when cpuid.c in the test case is compiled:<div>
<br></div><div>$ clang cpuid.c -O3 -S -o -</div>
<div><br></div><div><p style="margin:0px;font-size:11px;font-family:Menlo">## InlineAsm Start</p><p style="margin:0px;font-size:11px;font-family:Menlo">pushl  %ebx      # save %ebx before cpuid clobbers it.</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">cpuid</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">mov    %ebx,%ebx # move the __ebx output to %ebx.</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">popl   %ebx      # pop saved %ebx. Clobbers __ebx output.</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">## InlineAsm End</p></div><div><br></div><div><div>This happens because register '"ebx" is chosen for operand %1 which has constraint "=r". The attached patch adds %ebx to the clobber list to prevent this from happening.</div>

</div><div><br></div></div>
<br>_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
<br></blockquote></div><br></div>