vsro

Vector Shift Right by Octet

vsro vD, vA, vB

Shifts vector right by byte count.

Details

Shifts the 128-bit value in vA right by the number of octets (bytes) specified in the low 4 bits of vB, filling vacated positions on the left with zeros. This instruction is similar to vsr but uses only the low 4 bits of the shift count, limiting the shift to 0-15 bytes. No condition register fields are affected.

Pseudocode Operation

shift_count ← vB[124:127]
vD ← vA >> (shift_count * 8)

Programming Note

The vsro instruction shifts the contents of a vector register right by a specified number of bytes. Ensure that the shift amount is within the valid range (0-15) to avoid undefined behavior. This instruction requires the VEC bit in the MSR to be set; otherwise, it will raise an exception. Be cautious with alignment as shifting by byte boundaries can lead to unexpected results if not handled properly.

Example

vsro vd, va, vb

Encoding

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

Operands

  • vD
    Target
  • vA
    Data
  • vB
    Shift Count