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
20
11-06.md
20
11-06.md
|
|
@ -56,7 +56,7 @@ around the 286 and 386, many of the instruction-specific optimizations
|
|||
no longer hold, for the execution times of most instructions are quite
|
||||
different on the 286 and 386 than on the 8088. We have already seen one
|
||||
such example of the sometimes vast difference between 8088 and 286/386
|
||||
instruction execution times: **MOV [WordVar],0**, which has an Execution
|
||||
instruction execution times: `MOV [WordVar],0`, which has an Execution
|
||||
Unit execution time of 20 cycles on the 8088, has an EU execution time
|
||||
of just 3 cycles on the 286 and 2 cycles on the 386.
|
||||
|
||||
|
|
@ -65,17 +65,17 @@ has been improved enormously on the 286 and 386. The key to this
|
|||
improvement is the near elimination of effective address (EA)
|
||||
calculation time. Where an 8088 takes from 5 to 12 cycles to calculate
|
||||
an EA, a 286 or 386 usually takes no time whatsoever to perform the
|
||||
calculation. If a base+index+displacement addressing mode, such as **MOV
|
||||
AX,[WordArray+bx+si]**, is used on a 286 or 386, 1 cycle is taken to
|
||||
calculation. If a base+index+displacement addressing mode, such as `MOV
|
||||
AX,[WordArray+bx+si]`, is used on a 286 or 386, 1 cycle is taken to
|
||||
perform the EA calculation, but that's both the worst case and the only
|
||||
case in which there's any EA overhead at all.
|
||||
|
||||
The elimination of EA calculation time means that the EU execution time
|
||||
of memory-addressing instructions is much closer to the EU execution
|
||||
time of register-only instructions. For instance, on the 8088 **ADD
|
||||
[WordVar],100H** is a 31-cycle instruction, while **ADD DX,100H** is a
|
||||
time of register-only instructions. For instance, on the 8088 `ADD
|
||||
[WordVar],100H` is a 31-cycle instruction, while `ADD DX,100H` is a
|
||||
4-cycle instruction—a ratio of nearly 8 to 1. By contrast, on the 286
|
||||
**ADD [WordVar],100H** is a 7-cycle instruction, while **ADD DX,100H**
|
||||
`ADD [WordVar],100H` is a 7-cycle instruction, while `ADD DX,100H`
|
||||
is a 3-cycle instruction—a ratio of just 2.3 to 1.
|
||||
|
||||
It would seem, then, that it's less necessary to use the registers on
|
||||
|
|
@ -84,12 +84,12 @@ reasons we've already seen. The key is this: The 286 can execute
|
|||
memory-addressing instructions so fast that there's no spare instruction
|
||||
prefetching time during those instructions, so the prefetch queue runs
|
||||
dry, especially on the AT, with its one-wait-state memory. On the AT,
|
||||
the 6-byte instruction **ADD [WordVar],100H** is effectively at least a
|
||||
the 6-byte instruction `ADD [WordVar],100H` is effectively at least a
|
||||
15-cycle instruction, because 3 cycles are needed to fetch each of the
|
||||
three instruction words and 6 more cycles are needed to read **WordVar**
|
||||
three instruction words and 6 more cycles are needed to read `WordVar`
|
||||
and write the result back to memory.
|
||||
|
||||
Granted, the register-only instruction **ADD DX,100H** also slows
|
||||
Granted, the register-only instruction `ADD DX,100H` also slows
|
||||
down—to 6 cycles—because of instruction prefetching, leaving a ratio of
|
||||
2.5 to 1. Now, however, let's look at the performance of the same code
|
||||
on an 8088. The register-only code would run in 16 cycles (4 instruction
|
||||
|
|
@ -106,7 +106,7 @@ in 10.05 ms. On a 10 MHz AT clone, Listing 11.4 runs in 0.64 ms, while
|
|||
Listing 11.5 runs in 1.80 ms. Obviously, the AT is much faster...but the
|
||||
ratio of Listing 11.5 to Listing 11.4 is virtually identical on both
|
||||
computers, at 2.78 for the PC and 2.81 for the AT. If anything, the
|
||||
register-only form of **ADD** has a slightly *larger* advantage on the
|
||||
register-only form of `ADD` has a slightly *larger* advantage on the
|
||||
AT than it does on the PC in this case.
|
||||
|
||||
Theory confirmed.
|
||||
|
|
|
|||
Loading…
Reference in a new issue