Intel 64 and IA-32 Architectures Software Developers Manual Volume 1, Basic Architecture
7-16 Vol. 1
PROGRAMMING WITH GENERAL-PURPOSE INSTRUCTIONS
The SAR and SHR instructions can also be used to perform division by powers of
2 (see “SAL/SAR/SHL/SHR—Shift Instructions” in Chapter 4, “Instruction Set
Reference, N-Z,” of the Intel® 64 and IA-32 Architectures Software Developer’s
Manual, Volume 2B).
7.3.6.2 Double-Shift Instructions
The SHLD (shift left double) and SHRD (shift right double) instructions shift a speci-
fied number of bits from one operand to another (see Figure 7-9). They are provided
to facilitate operations on unaligned bit strings. They can also be used to implement
a variety of bit string move operations.
Figure 7-8. SAR Instruction Operation
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 0 0 0 1 1 1
X
Initial State (Positive Operand)
CF
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 0 0 0 1 1
1
After 1-bit SAR Instruction
1 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
X
Initial State (Negative Operand)
Operand
1 1 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
After 1-bit SAR Instruction
CF