Change bold code snippets to inline code blocks
This commit is contained in:
parent
f658bfbb40
commit
3c76d884ef
185 changed files with 1772 additions and 1772 deletions
14
12-02.md
14
12-02.md
|
|
@ -14,9 +14,9 @@ which calculates the same sum and leaves the registers in the same state
|
|||
as the first example, but avoids indexed addressing.
|
||||
|
||||
In protected mode, the definition of indexed addressing is a tad more
|
||||
complex. The use of two registers to address memory, as in **MOV EAX,
|
||||
[EDX+EDI]**, still qualifies for the one-cycle penalty. In addition, the
|
||||
use of 386/486 scaled addressing, as in **MOV [ECX\*2],EAX**, also
|
||||
complex. The use of two registers to address memory, as in `MOV EAX,
|
||||
[EDX+EDI]`, still qualifies for the one-cycle penalty. In addition, the
|
||||
use of 386/486 scaled addressing, as in `MOV [ECX*2],EAX`, also
|
||||
constitutes indexed addressing, even if only one register is used to
|
||||
point to memory.
|
||||
|
||||
|
|
@ -24,8 +24,8 @@ All this fuss over one cycle! You might well wonder how much difference
|
|||
one cycle could make. After all, on the 8088, effective address
|
||||
calculations take a *minimum* of 5 cycles. On the 486, however, 1 cycle
|
||||
is a big deal because many instructions, including most register-only
|
||||
instructions (**MOV**, **ADD**, **CMP**, and so on) execute in just 1
|
||||
cycle. In particular, **MOV**s to and from memory execute in 1 cycle—if
|
||||
instructions (`MOV`, `ADD`, `CMP`, and so on) execute in just 1
|
||||
cycle. In particular, `MOV`s to and from memory execute in 1 cycle—if
|
||||
they're not hampered by something like indexed addressing, in which case
|
||||
they slow to half speed (or worse, as we will see shortly).
|
||||
|
||||
|
|
@ -64,7 +64,7 @@ MOV AX,[BX]
|
|||
```
|
||||
|
||||
there's no way that the 486 can calculate the address referenced by
|
||||
**MOV AX,[BX]** until **MOV BX,OFFSET MemVar** finishes, so pipelining
|
||||
`MOV AX,[BX]` until `MOV BX,OFFSET MemVar` finishes, so pipelining
|
||||
that calculation ahead of time is not possible. A good workaround is
|
||||
rearranging your code so that at least one instruction lies between the
|
||||
loading of the memory pointer and its use. For example,
|
||||
|
|
@ -102,7 +102,7 @@ it's used.
|
|||
In 32-bit protected mode, however, the penalty is, in fact, the 1 cycle
|
||||
that Intel .
|
||||
|
||||
Considering that **MOV** normally takes only one cycle total, that's
|
||||
Considering that `MOV` normally takes only one cycle total, that's
|
||||
quite a loss. For example, the postdecrement loop shown above is 2 full
|
||||
cycles faster than the preincrement loop, resulting in a 29 percent
|
||||
improvement in the performance of the entire loop. But wait, there's
|
||||
|
|
|
|||
Loading…
Reference in a new issue