Retidy, removing align=left from headings and empty paragraphs

This commit is contained in:
James Gregory 2013-12-30 15:37:13 +11:00
commit a96a114403
362 changed files with 8472 additions and 5040 deletions

View file

@ -1,5 +1,4 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
@ -19,17 +18,21 @@
<center>
<table border="1">
<tr>
<td><a href="19-02.html">Previous</a></td>
<td>
<a href="19-02.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td>
<td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="19-04.html">Next</a></td>
<td>
<a href="19-04.html">Next</a>
</td>
</tr>
</table>
</center>
<p><br /></p>
<h3 id="Heading7">Faster Addressing and More</h3>
<p>I&rsquo;ll spend the rest of this chapter covering a variety of Pentium optimization tips. For starters, effective address calculations (that is, the addition and scaling required to calculate a memory operand&rsquo;s address, as for example in <b>MOV EAX,[EBX+ECX*2+4]</b>) never take any extra cycles on the Pentium (other than possibly an AGI cycle), even for the use of base+index addressing (as in <b>MOV [ESI+EDI],EAX</b>) or scaling (*2, *4, or *8, as in <b>INC ARRAY[ESI*4]</b>). On the 486, both of the latter cases cause a 1-cycle penalty. The faster effective address calculations have the side effect of making <b>LEA</b> very attractive as an arithmetic instruction. <b>LEA</b> can add any two registers, one of which can be multiplied by one, two, four, or eight, plus a constant value, and can store the result in any register&mdash;all in one cycle, apart from AGIs. Not only that, but as we&rsquo;ll see in the next chapter, <b>LEA</b> can go through either pipe, whereas <b>SHL</b> can only go through the U-pipe, so <b>LEA</b> is often a superior choice for multiplication by three, four, five, eight, or nine. (<b>ADD</b> is the best choice for multiplication by two.) If you use <b>LEA</b> for arithmetic, do remember that unlike <b>ADD</b> and <b>SHL</b>, it doesn&rsquo;t modify any flags.</p>
@ -65,16 +68,20 @@ mov eax,[ebx]
<p>As with the 486, don&rsquo;t use <b>ENTER</b> or <b>LEAVE</b>, which are slower than the equivalent discrete instructions. Also, start using <b>TEST <i>reg,reg</i></b> instead of <b>AND <i>reg,reg</i></b> or <b>OR <i>reg,reg</i></b> to test whether a register is zero. The reason, as we&rsquo;ll see in Chapter 21, is that <b>TEST</b>, unlike <b>AND</b> and <b>OR</b>, never modifies the target register. Although in this particular case <b>AND</b> and <b>OR</b> don&rsquo;t modify the target register either, the Pentium has no way of knowing that ahead of time, so if <b>AND</b> or <b>OR</b> goes through the U-pipe, the Pentium may have to shut down the V-pipe for a cycle to avoid potential dependencies on the result of the <b>AND</b> or <b>OR</b>. <b>TEST</b> suffers from no such potential dependencies.</p>
<p><br /></p>
<center>
<table border="1">
<tr>
<td><a href="19-02.html">Previous</a></td>
<td>
<a href="19-02.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td>
<td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="19-04.html">Next</a></td>
<td>
<a href="19-04.html">Next</a>
</td>
</tr>
</table>
</center>