vrlb

Vector Rotate Left Byte

vrlb vD, vA, vB

Rotates each byte of the source vector left by a specified number of bits.

Details

For vrlb, each byte in VSR[VRA+32] is rotated left by the number of bits specified in the low-order 3 bits of the corresponding byte in VSR[VRB+32]. The result is stored in VSR[VRT+32].

Pseudocode Operation

if MSR.VEC=0 then
    Vector_Unavailable()
do i = 0 to 7
    src ← VSR[VRA+32].byte[i]
    shVSR[VRB+32].byte[i].bit[5:7]
    VSR[VRT+32].byte[i] ← src <<< sh

Programming Note

The vrlb instruction rotates each byte in the source vector left by a specified number of bits determined by another vector. Ensure that the Vector Facility is enabled (MSR.VEC=1) to avoid exceptions. The shift amount is derived from the high-order 3 bits of each byte in the second vector, so be cautious with bit manipulation to achieve the desired rotation.

Example

vrlb vd, va, vb

Encoding

Binary Layout
4
0
vD
6
vA
11
vB
16
4
 
Format VX-form
Opcode 0x10000004
Extension VMX (AltiVec)
Registers Altered MSR

Operands

  • vD
    Target
  • vA
    Data
  • vB
    Rotate Count
  • VRT
    Target Vector Register
  • VRA
    Source Vector Register
  • VRB
    Shift Control Vector Register