[ Previous | Next | Contents | Home | Search ]
AIX Version 4.3 Assembler Language Reference

Extended Mnemonics of 64-bit Fixed-Point Rotate and Shift Instructions

A set of extended mnemonics are provided for extract, insert, rotate, shift, clear, and clear left and shift left operations. This article discusses the following:

Alternative Input Format

The alternative input format is applied to the following POWER and PowerPC instructions.

POWERPowerPC
rlimi[.] rlwimi[.]
rlinm[.] rlwinm[.]
rlnm[.] rlwnm[.]
rlmi[.] Not applicable

Five operands are normally required for these instructions. These operands are:

RA, RS, SH, MB, ME

MB indicates the first bit with a value of 1 in the mask, and ME indicates the last bit with a value of 1 in the mask. The assembler supports the following operand format.

RARSSHBM

BM is the mask itself. The assembler generates the MB and ME operands from the BM operand for the instructions. The assembler checks the BM operand first. If an invalid BM is entered, error 78 is reported.

A valid mask is defined as a single series (one or more) of bits with a value of 1 surrounded by zero or more bits with a value of z0. A mask of all bits with a value of 0 may not be specified.

64-bit Rotate and Shift Extended Mnemonics for POWER and PowerPC

The extended mnemonics for the rotate and shift instructions are in the POWER and PowerPC intersection area (com assembly mode). A set of rotate and shift extended mnemonics provide for the following operations:

Extract Selects a field of n bits starting at bit position b in the source register. This field is right- or left-justified in the target register. All other bits of the target register are cleared to 0.
Insert Selects a left- or right-justified field of n bits in the source register. This field is inserted starting at bit position b of the target register. Other bits of the target register are unchanged. No extended mnemonic is provided for insertion of a left-justified field when operating on doublewords, since such an insertion requires more than one instruction.
Rotate Rotates the contents of a register right or left n bits without masking.
Shift Shifts the contents of a register right or left n bits. Vacated bits are cleared to 0 (logical shift).
Clear Clears the leftmost or rightmost n bits of a register to 0.
Clear left and shift left Clears the leftmost b bits of a register, then shifts the register by n bits. This operation can be used to scale a known nonnegative array index by the width of an element.

The rotate and shift extended mnemonics are shown in the following table. The N operand specifies the number of bits to be extracted, inserted, rotated, or shifted. Because expressions are introduced when the extended mnemonics are mapped to the base mnemonics, certain restrictions are imposed to prevent the result of the expression from causing an overflow in the SH, MB, or ME operand.

To maintain compatibility with previous versions of AIX, n is not restricted to a value of 0. If n is 0, the assembler treats 32-n as a value of 0.

63-bit Rotate and Shift Extended Mnemonics for PowerPC
Operation Extended Mnemonic Equivalent to Restrictions
Extract double word and right justify immediate extrdi RA, RS, n, b rldicl RA, RS, b + n, 64 - n n > 0
Rotate double word left immediate rotldi RA, RS, n rldicl RA, RS, n, 0 None
Rotate double word right immediate rotrdi RA, RS, n rldicl RA, RS, 64 - n, 0 None
Rotate double word right immediate srdi RA, RS, n rldicl RA, RS, 64 - n, n n < 64
Clear left double word immediate clrldi RA, RS, n rldicl RA, RS, 0, n n < 64
Extract double word and left justify immediate extldi RA, RS, n, b rldicr RA, RS, b, n - 1 None
Shift left double word immediate sldi RA, RS, n rldicr RA, RS, n, 63 - n None
Clear right double word immediate clrrdi RA, RS, n rldicr RA, RS, 0, 63 - n None
Clear left double word and shift left immediate clrlsldi RA, RS, b, n rldic RA, RS, n, b - n None
Insert double word from right immediate insrdi RA, RS, n, b rldimi RA, RS, 64 - (b + n), b None
Rotate double word left rotld RA, RS, RB rldcl RA, RS, RB, 0 None
Note: All of these extended mnemonics can be coded with a final . (period) to cause the Rc bit to be set in the underlying instruction.

Examples

Related Information

Extended Instruction Mnemonics Overview.

Extended Mnemonics of Branch Instructions.

Extended Mnemonics of Condition Register Logical Instructions.

Extended Mnemonics of Fixed-Point Arithmetic Instructions.

Extended Mnemonics of Fixed-Point Compare Instructions.

Extended Mnemonics of Fixed-Point Load Instructions.

Extended Mnemonics of Fixed-Point Logical Instructions.

Extended Mnemonics of Fixed-Point Trap Instructions.

Extended Mnemonics of Moving from or to Special-Purpose Registers.

The rlwinm or rlinm (Rotate Left Word Immediate Then AND with Mask) instruction.


[ Previous | Next | Contents | Home | Search ]