vsrq

Vector Shift Right Quadword

vsrq vD, vA, vB

Shifts the contents of a vector register right by a specified number of bits.

Details

The vsrq instruction shifts the contents of VSR[VRA+32] right by the number of bits specified in the low-order 7 bits of VSR[VRB+32]. The result is placed into VSR[VRT+32].

Pseudocode Operation

if MSR.VEC=0 then
    Vector_Unavailable()
src1 ←VSR[VRA+32]
src2 ←VSR[VRB+32].bit[57:63]
VSR[VRT+32] ←CHOP128(EXTZ(src1) >> src2)

Programming Note

The vsrq instruction requires the Vector Facility to be enabled in the MSR register. Ensure that the shift amount is within the range of 0-127 bits to avoid unexpected results. The operation is performed on quadword elements, so alignment considerations are not necessary for this specific instruction.

Example

vsrq vd, va, vb

Encoding

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

Operands

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