Page 126 - A Practical Guide from Design Planning to Manufacturing
P. 126
Computer Architecture 99
TABLE 4-2 Common x86 Instructions
Instruction Instruction Percent of Instruction Overall
type instructions executed type percentage
Load Data transfer 22% Data transfer 38%
Branch Control flow 20% Computation 35%
Compare Computation 16% Control flow 22%
Store Data transfer 12%
Add Computation 8%
And Computation 6%
Sub Computation 5%
Move Data transfer 4%
Call Control flow 1%
Return Control flow 1%
Total 95%
Table 4-2 shows that for programs that are considered important
measures of performance, the 10 most common instructions make up 95
percent of the total instructions executed. The performance of any imple-
mentation is determined largely by how these instructions are executed.
Computation instructions
Computational instructions create new results from operations on data
values. Any practical architecture is likely to provide the basic arithmetic
and logical operations shown in Table 4-3.
A compare instruction tests whether a particular value or pair of
values meets any of the defined conditions. Logical operations typically
treat each bit of each operand as a separate boolean value. Instructions
to shift all the bits of an operand or reverse the order of bytes make it
easier to encode multiple booleans into a single operand.
The actual operations defined by different architectures do not vary
that much. What makes different architectures most distinct from one
TABLE 4-3 Computation Instructions 2
Arithmetic operations Logical operations
ADD Add AND True if A and B true
SUB Subtract OR True if A or B true
MUL Multiply NOT True if A is false
DIV Divide XOR True if only one of
INC Increment A and B is true
DEC Decrement SHL Shift bits left
CMP Compare SHR Shift bits right
BSWAP Reverse byte order
2
“IA-32 Software Developer’s Manual.”