6-29
INSTRUCTION SET SUMMARY
6.6.LOGICAL INSTRUCTIONS
The logical instructions AND, OR, XOR (exclusive or), and NOT perform the standard Boolean
operations for which they are named. The AND, OR, and XOR instructions require two oper-
ands; the NOT instruction operates on a single operand.
6.7.SHIFT AND ROTATE INSTRUCTIONS
The shift and rotate instructions rearrange the bits within an operand. These instructions fall into
the following classes:
Shift.
Double shift.
Rotate.
6.7.1.Shift Instructions
The SAL (shift arithmetic left), SHL (shift logical left), SAR (shift arithmetic right), SHR (shift
logical right) instructions perform an arithmetic or logical shift of the bits in a byte, word, or
doubleword.
The SAL and SHL instructions perform the same operation (refer to Figure 6-6). They shift the
source operand left by from 1 to 31 bit positions. Empty bit positions are cleared. The CF flag
is loaded with the last bit shifted out of the operand.
.
The SHR instruction shifts the source operand right by from 1 to 31 bit positions (refer to Figure
6-7). As with the SHL/SAL instruction, the empty bit positions are cleared and the CF flag is
loaded with the last bit shifted out of the operand.
Figure 6-6. SHL/SAL Instruction Operation
1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 1 1 1
X
Initial State
CF
0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 1 1 1 0
1
After 1-bit SHL/SAL Instruction
0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0
0
After 10-bit SHL/SAL Instruction
Operand