rldimi

Rotate Left Doubleword Immediate Mask Insert

rldimi RA, RS, SH, MB

Rotates 64-bit value and inserts into target under mask.

Details

The Rotate Left Doubleword Immediate Mask Insert (rldimi) instruction rotates the contents of register RS left by a specified number of bits (SH). A mask is generated with 1-bits from bit MB through bit 63 and 0-bits elsewhere. The rotated data are ANDed with this mask, and the result is placed into register RA.

Pseudocode Operation

SH ← sh5 || sh0:4
r ← ROTL64((RS), SH)
MB ← mb5 || mb0:4
m ← MASK(MB, 63)
RA ← r & m

Programming Note

The rldimi instruction is useful for performing masked left rotations on 64-bit values. Ensure that the shift amount (SH) and mask bits (MB) are within valid ranges to avoid undefined behavior. This instruction operates at user privilege level and does not generate exceptions under normal conditions, but incorrect usage can lead to unexpected results.

Example

rldimi r4, r3, 3, 0

Encoding

Binary Layout
30
0
RS
6
RA
11
SH
16
MB
21
3
27
SH
31
 
Format MD-form
Opcode 0x78000006
Extension Base

Operands

  • RA
    Target
  • RS
    Source
  • SH
    Shift
  • MB
    Mask Begin