vsro

Vector Shift Right by Octet

vsro vD, vA, vB

Shifts vector right by byte count.

Details

The Vector Shift Right by Octet (vsro) instruction shifts the contents of VSR[VRA+32] to the right by the number of bytes specified in bits 121:124 of VSR[VRB+32]. Bits shifted out of byte 15 are lost, and zeros are supplied to the vacated bytes on the left. The result is placed into VSR[VRT+32], unless any byte element in VSR[VRB+32] does not meet the shift criteria, in which case VSR[VRT+32] is undefined.

Pseudocode Operation

if MSR.VEC=0 then Vector_Unavailable()
shb ←VSR[VRB+32].bit[121:124] << 3
VSR[VRT+32] ←VSR[VRA+32] >> shb

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