AN2491 Freescale Semiconductor / Motorola, AN2491 Datasheet - Page 3

no-image

AN2491

Manufacturer Part Number
AN2491
Description
Simplified Mnemonics for PowerPC Instructions
Manufacturer
Freescale Semiconductor / Motorola
Datasheet

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
AN2491NFHP
Manufacturer:
PANASON
Quantity:
5 510
Part Number:
AN2491NFHP
Manufacturer:
MAXIM
Quantity:
5 510
3 Rotate and Shift Simplified Mnemonics
Rotate and shift instructions provide powerful, general ways to manipulate register contents, but can be
difficult to understand. Simplified mnemonics are provided for the following operations:
3.1 Operations on Words
The simplified mnemonics in Table 3 can be coded with a dot (.) suffix to cause the Rc bit to be set in the
underlying instruction.
Examples using word mnemonics follow:
MOTOROLA
Extract and left justify word immediate
Extract and right justify word immediate extrwi rA,rS,n,b (n > 0)
Insert from left word immediate
Insert from right word immediate
Rotate left word immediate
Rotate right word immediate
Rotate word left
Shift left word immediate
Shift right word immediate
Clear left word immediate
Clear right word immediate
Clear left and shift left word immediate
1. Extract the sign bit (bit 0) of rS and place the result right-justified into rA.
2. Insert the bit extracted in (1) into the sign bit (bit 0) of rB.
3. Shift the contents of rA left 8 bits.
4. Clear the high-order 16 bits of rS and place the result into rA.
Extract—Select a field of n bits starting at bit position b in the source register; left or right justify
this field in the target register; clear all other bits of the target register.
Insert—Select a left- or right-justified field of n bits in the source register; insert this field starting
at bit position b of the target register; leave other bits of the target register unchanged.
Rotate—Rotate the contents of a register right or left n bits without masking.
Shift—Shift the contents of a register right or left n bits, clearing vacated bits (logical shift).
Clear—Clear the leftmost or rightmost n bits of a register.
Clear left and shift left—Clear the leftmost b bits of a register, then shift the register left by n bits.
This operation can be used to scale a (known non-negative) array index by the width of an element.
extrwi rA,rS,1,0
insrwi rB,rA,1,0
slwi rA,rA,8
clrlwi rA,rS,16
Operation
Table 3. Word Rotate and Shift Simplified Mnemonics
Simplified Mnemonics for PowerPC™ Instructions
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
equivalent to
equivalent to
equivalent to
equivalent to
extlwi rA,rS,n,b (n > 0)
inslwi rA,rS,n,b (n > 0)
insrwi rA,rS,n,b (n > 0)
rotlwi rA,rS,n
rotrwi rA,rS,n
rotlw rA,rS,rB
slwi rA,rS,n (n < 32)
srwi rA,rS,n (n < 32)
clrlwi rA,rS,n (n < 32)
clrrwi rA,rS,n (n < 32)
clrlslwi rA,rS,b,n (n
Simplified Mnemonic
b
Rotate and Shift Simplified Mnemonics
31) rlwinm rA,rS,n,b – n,31 – n
rlwinm rA,rS,b,0,n – 1
rlwinm rA,rS,b + n,32 – n,31
rlwimi rA,rS,32 – b,b,(b + n) – 1
rlwimi rA,rS,32 – (b + n),b,(b + n) – 1
rlwinm rA,rS,n,0,31
rlwinm rA,rS,32 – n,0,31
rlwnm rA,rS,rB,0,31
rlwinm rA,rS,n,0,31 – n
rlwinm rA,rS,32 – n,n,31
rlwinm rA,rS,0,n,31
rlwinm rA,rS,0,0,31 – n
rlwinm rA,rS,1,31,31
rlwimi rB,rA,31,0,0
rlwinm rA,rA,8,0,23
rlwinm rA,rS,0,16,31
Equivalent to:
3

Related parts for AN2491