<span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">Hi Jacob,<br><br>As far as I know, an x86 'mov' instruction always uses an ALU resource. According to Agner Fog's documents (</span><a href="http://www.agner.org/optimize/">http://www.agner.org/optimize/</a>), it can execute on port 0, 1 or 5 on recent architectures though. So it's not that likely to be resource limited. But it still occupies an instruction slot throughout the entire pipeline, costing power and potentially limiting other actual arithmetic instructions from scheduling optimally. Also, it has a latency of 1 cycle, while non-destructive instructions would shorten the latency of dependent instructions.<div>
<br></div><div>My immediate concern is getting a reasonable estimate for how often this macro-op fusion could be performed. This could then be used to evaluate whether it's worth the added decoder complexity.</div><div>
<br></div><div>Cheers,</div><div>Nicolas</div><div><br><br><div class="gmail_quote">On Fri, Apr 8, 2011 at 7:27 PM, Jakob Stoklund Olesen <span dir="ltr"><<a href="mailto:stoklund@2pi.dk">stoklund@2pi.dk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im"><br>
On Apr 8, 2011, at 9:56 AM, NAKAMURA Takumi wrote:<br>
<br>
>>>                 8B C3 mov eax, ebx<br>
>>>                 03 C1 add eax, ecx<br>
>>> becomes<br>
>>>                 8B C3 03 C1 add eax, ebx, ecx<br>
><br>
> In my understanding, twoaddr pass tends to emit such a sequence.<br>
<br>
</div>Yes, it always does, and the coalescer tries very hard to eliminate the copy.<br>
<div class="im"><br>
> Though I don't have sandybridge, I have not measured.<br>
> Prior processors(intel and amd) might spend 1 ALU to execute "mov",<br>
> then mov - add must have dependency.<br>
<br>
</div>I think you will find it is more complicated than that. A 'mov' usually doesn't need an ALU resource.<br>
<br>
You should read about the 'reservation station' style register renaming.<br>
<br>
<a href="http://en.wikipedia.org/wiki/Register_renaming" target="_blank">http://en.wikipedia.org/wiki/Register_renaming</a><br>
<a href="http://www.intel.com/Assets/PDF/manual/248966.pdf" target="_blank">http://www.intel.com/Assets/PDF/manual/248966.pdf</a><br>
<font color="#888888"><br>
/jakob<br>
<br>
</font></blockquote></div><br></div>