6-32
INSTRUCTION SET SUMMARY
The SHLD instruction shifts the bits in the destination operand to the left and fills the empty bit
positions (in the destination operand) with bits shifted out of the source operand. The destination
and source operands must be the same length (either words or doublewords). The shift count can
range from 0 to 31 bits. The result of this shift operation is stored in the destination operand, and
the source operand is not modified. The CF flag is loaded with the last bit shifted out of the desti-
nation operand.
The SHRD instruction operates the same as the SHLD instruction except bits are shifted to the
left in the destination operand, with the empty bit positions filled with bits shifted out of the
source operand.
6.7.3.Rotate Instructions
The ROL (rotate left), ROR (rotate right), RCL (rotate through carry left) and RCR (rotate
through carry right) instructions rotate the bits in the destination operand out of one end and
back through the other end (refer to Figure 6-10). Unlike a shift, no bits are lost during a rotation.
The rotate count can range from 0 to 31.
Figure 6-9. SHLD and SHRD Instruction Operations
Destination (Memory or Register)
CF
31
0
Source (Register)
31
0
Destination (Memory or Register)
CF
31
0
Source (Register)
31
0
SHRD Instruction
SHLD Instruction