
CPU32
REFERENCE MANUAL
INSTRUCTION SET
MOTOROLA
4-9
4.3.5 Shift and Rotate Instructions
The arithmetic shift instructions, ASR and ASL, and logical shift instructions, LSR and
LSL, provide shift operations in both directions. The ROR, ROL, ROXR, and ROXL in-
structions perform rotate (circular shift) operations, with and without the extend bit. All
shift and rotate operations can be performed on either registers or memory.
Register shift and rotate operations shift all operand sizes. The shift count may be
specified in the instruction operation word (to shift from 1 to 8 places) or in a register
(modulo 64 shift count).
Memory shift and rotate operations shift word-length operands one bit position only.
The SWAP instruction exchanges the 16-bit halves of a register. Performance of shift/
rotate instructions is enhanced so that use of the ROR and ROL instructions with a
shift count of eight allows fast byte swapping.
Table 4-5
is a summary of the shift and
rotate operations.
4.3.6 Bit Manipulation Instructions
Bit manipulation operations are accomplished using the following instructions: bit test
(BTST), bit test and set (BSET), bit test and clear (BCLR), and bit test and change
(BCHG). All bit manipulation operations can be performed on either registers or mem-
Table 4-5 Shift and Rotate Operations
Instruction
ASL
Syntax
Dn, Dn
#
data
,
Dn
ea
Dn, Dn
#
data
,
Dn
ea
Dn, Dn
#
data
,
Dn
ea
Dn, Dn
#
data
,
Dn
ea
Dn, Dn
#
data
,
Dn
ea
Dn, Dn
#
data
,
Dn
ea
Dn, Dn
#
data
,
Dn
ea
Dn, Dn
#
data
,
Dn
ea
Dn
Operand Size
8, 16, 32
8, 16, 32
16
8, 16, 32
8, 16, 32
16
8, 16, 32
8, 16, 32
16
8, 16, 32
8, 16, 32
16
8, 16, 32
8, 16, 32
16
8, 16, 32
8, 16, 32
16
8, 16, 32
8, 16, 32
16
8, 16, 32
8, 16, 32
16
16
Operation
ASR
LSL
LSR
ROL
ROR
ROXL
ROXR
SWAP
X/C
0
X/C
X/C
0
X/C
0
C
C
C
X
C
X
MSW
LSW
F
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
n
.