vsr

Vector Shift Right

vsr vD, vA, vB

Shifts vector right by octet count in vB.

Details

The Vector Shift Right (vsr) instruction shifts the elements of a vector right by a specified number of bits. The shift amount is determined by the contents of a control register.

Pseudocode Operation

// Shifts vector right by octet count in vB

Programming Note

The vsr instruction is commonly used for bit manipulation in vector operations, where each element of the vector is shifted right by a number of bits specified in a control register. Ensure that the control register contains valid shift amounts to avoid unexpected results. This operation does not require any specific privilege level and will not generate exceptions unless there are alignment issues with the vector data.

Example

vsr vd, va, vb

Encoding

Binary Layout
4
0
vD
6
vA
11
vB
16
708
21
 
Format VX-form
Opcode 0x100002C4
Extension VMX (AltiVec)

Operands

  • vD
    Target
  • vA
    Data
  • vB
    Shift Count