Convert notes into blockquotes
This commit is contained in:
parent
832fb15e54
commit
8ed9dea394
105 changed files with 884 additions and 411 deletions
25
09-02.md
25
09-02.md
|
|
@ -68,9 +68,13 @@ now on) by arranging your operands so that the multiplier (always the
|
|||
rightmost operand following **MUL** or **IMUL**) is no larger than the
|
||||
other operand.
|
||||
|
||||
------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
 *Why? Because the 386 processes one multiplier bit per cycle and immediately ends a multiplication when all significant bits of the multiplier have been processed, so fewer cycles are required to multiply a large multiplicand times a small multiplier than a small multiplicand times a large multiplier, by a factor of about 1 cycle for each significant multiplier bit eliminated.*
|
||||
------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
> 
|
||||
> Why? Because the 386 processes one multiplier bit per cycle and
|
||||
> immediately ends a multiplication when all significant bits of the
|
||||
> multiplier have been processed, so fewer cycles are required to multiply
|
||||
> a large multiplicand times a small multiplier than a small multiplicand
|
||||
> times a large multiplier, by a factor of about 1 cycle for each
|
||||
> significant multiplier bit eliminated.
|
||||
|
||||
(There's a minimum execution time on this trick; below 3 significant
|
||||
multiplier bits, no additional cycles are saved.) For example,
|
||||
|
|
@ -89,9 +93,11 @@ This highlights another interesting point: **MUL** and **IMUL** on the
|
|||
386 are so fast that alternative multiplication approaches, while
|
||||
generally still faster, are worthwhile only in truly time-critical code.
|
||||
|
||||
------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
 *On 386SXs and uncached 386s, where code size can significantly affect performance due to instruction prefetching, the compact **MUL** and **IMUL** instructions can approach and in some cases even outperform the "optimized" alternatives.*
|
||||
------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
> 
|
||||
> On 386SXs and uncached 386s, where code size can significantly affect
|
||||
> performance due to instruction prefetching, the compact **MUL** and
|
||||
> **IMUL** instructions can approach and in some cases even outperform the
|
||||
> "optimized" alternatives.
|
||||
|
||||
All in all, **MUL** and **IMUL** are reasonable performers on the 386,
|
||||
no longer to be avoided in most cases—and you can help that along by
|
||||
|
|
@ -127,9 +133,10 @@ deal is handling **REPNZ SCASB** matches, which require checking the
|
|||
remainder of the string with **REPZ CMPS** and restarting **REPNZ
|
||||
SCASB** if no match is found.
|
||||
|
||||
------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
 *Rob points out that the number of **REPNZ SCASB** matches can easily be reduced simply by scanning for the character in the searched-for string that appears least often in the buffer being searched.*
|
||||
------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
> 
|
||||
> Rob points out that the number of **REPNZ SCASB** matches can easily be
|
||||
> reduced simply by scanning for the character in the searched-for string
|
||||
> that appears least often in the buffer being searched.
|
||||
|
||||
Imagine, if you will, that you're searching for the string "EQUAL." By
|
||||
my approach, you'd use **REPNZ SCASB** to scan for each occurrence of
|
||||
|
|
|
|||
Loading…
Reference in a new issue