rldicr (Rotate Left Double Word Immediate then Clear Right) instruction

Purpose

Rotate the contents of a general purpose register left by the number of bits specified by an immediate value. Clear a specified number of low-order bits. Place the results in another general purpose register.

Syntax

Bits Value
0 - 5 30
6 - 10 S
11 - 15 A
16 - 20 sh
21 - 26 me
27 - 29 1
30 sh
31 Rc
POWER® family
rldicr RA, RS, SH, MB (Rc=0)
rldicr. RA, RS, SH, MB (Rc=1)

Description

The contents of general purpose register (GPR) RS are rotated left the number of bits specified by operand SH. A mask is generated having 1 bits from bit 0 through bit ME and 0 bits elsewhere. The rotated data is ANDed with the generated mask and the result is placed into GPR RA.

Note that rldicr can be used to extract, rotate, shift, and clear bit fields using the methods shown below:

  • To extract an n-bit field, that starts at bit position b in GPR RS, left-justified into GPR RA (clearing the remaining 64 - n bits of GPR RA), set SH = b and ME = n - 1.
  • To rotate the contents of a register left (right) by n bits, set SH = n (64 - n) and ME = 63.
  • To shift the contents of a register left by n bits, by setting SH = n and ME = 63 - n.
  • To clear the low-order n bits of a register, by setting SH = 0 and ME = 63 - n.

Other registers altered:

  • Condition Register (CR0 field):

    Affected: LT, GT, EQ, SO (if Rc = 1)

Parameters

Item Description
RA Specifies the target general purpose register for the result of the instruction.
RS Specifies the source general purpose register containing the operand.
SH Specifies the (immediate) shift value for the operation.
ME Specifies the end value (bit number) of the mask for the operation.

Implementation

This instruction is defined only for 64-bit implementations. Using it on a 32-bit implementation will cause the system illegal instruction error handler to be invoked.