
MOTOROLA
4-16
ADDRESSING MODES AND INSTRUCTION SET SUMMARY
For More Information On This Product,
Go to: www.freescale.com
RCPU
REFERENCE MANUAL
ing the leftmost or rightmost bits of a register, left justifying or right justifying an ar-
bitrary field, and simple rotates and shifts. Some of these are shown as examples
with the rotate instructions. In addition,
E.4 Simplified Mnemonics for Rotate and
Shift Instructions
provides a list of these mnemonics.
4.3.4.1 Integer Rotate Instructions
Integer rotate instructions rotate the contents of a register. The result of the rotation
is inserted into the target register under control of a mask (if a mask bit is one the
associated bit of the rotated data is placed into the target register, and if the mask
bit is zero the associated bit in the target register is unchanged), or ANDed with a
mask before being placed into the target register.
Rotate left instructions allow right-rotation of the contents of a register to be per-
formed by a left-rotation of 32 -
n
, where
n
is the number of bits by which to rotate
right.
The integer rotate instructions are summarized in
Table 4-5
.
Table 4-5 Integer Rotate Instructions
Name
Mnemonic
Operand Syntax
Operation
Rotate Left
Word
Immediate
then AND
with Mask
rlwinm
rlwinm
.
r
A
,r
S
,
SH
,
MB
,
ME
The contents of register
r
S are rotated left by the number of bits
specified by operand SH. A mask is generated having 1-bits from
the bit specified by operand MB through the bit specified by
operand ME and 0-bits elsewhere. The rotated data is ANDed with
the generated mask and the result is placed into register
r
A.
rlwinm
rlwinm.
Rotate Left Word Immediate then AND with Mask
Rotate Left Word Immediate then AND with Mask with
CR Update. The dot suffix enables the update of the
condition register.
Simplified mnemonics:
extlwi r
A
,r
S,
n
,b
rlwinm r
A
,r
S
,
b
,0,
n
-1
srwi
r
A
,r
S
,
n
rlwinm r
A
,r
S
,
32-
n
,
n
,
31
clrrwi r
A
,r
S
,
n
rlwinm r
A
,r
S
,0,0,
31-
n
Note: The
rlwinm
instruction can be used for extracting, clearing
and shifting bit fields using the methods shown below:
To extract an
n
-bit field that starts at bit position
b
in register
r
S,
right-justified into
r
A (clearing the remaining 32 -
n
bits of
r
A), set
SH =
b
+
n
, MB = 32 -
n
, and ME = 31.
To extract an
n
-bit field that starts at bit position
b
in
r
S, left-justified
into
r
A, set SH =
b
, MB = 0, and ME =
n
- 1.
To rotate the contents of a register left (right) by
n
bits, set SH =
n
(32 -
n
), MB = 0, and ME = 31.
To shift the contents of a register right by
n
bits, set SH = 32 -
n
, MB
=
n
, and ME = 31.
To clear the high-order
b
bits of a register and then shift the result
left by
n
bits, set SH =
n
, MB =
b
-
n
and ME = 31 -
n
.
To clear the low-order
n
bits of a register, set SH = 0, MB = 0, and
ME = 31 -
n
.
F
Freescale Semiconductor, Inc.
n
.