rotatel

Rotate Left

rotatel RT,RA,RB

Rotates the contents of a register to the left by a specified number of bit positions.

Details

The Rotate Left instructions allow right-rotation of the contents of a register to be performed (in concept) by a left-rotation of 64−n, where n is the number of bits by which to rotate right. They allow right-rotation of the contents of the low-order 32 bits of a register to be performed (in concept) by a left-rotation of 32−n, where n is the number of bits by which to rotate right.

Pseudocode Operation

if 'rotatel' then
    RT <- (RA) << (RB)

Programming Note

The rotatel instruction performs a left rotation on the contents of a register. For right rotations, calculate the equivalent left rotation by subtracting the number of bits to rotate from 64 for full registers or 32 for low-order bits. Ensure that the shift count (RB) is within valid bounds to avoid undefined behavior.

Example

rotatel r3, r4, r5

Encoding

Binary Layout
18
0
LI
6
AA
30
LK
31
 
Format XO-form
Opcode
Extension Base
Registers Altered CR0, XER

Operands

  • RT
    Target General Purpose Register
  • RA
    Source General Purpose Register
  • RB
    Source General Purpose Register