vrlh

Vector Rotate Left Halfword

vrlh vD, vA, vB

Rotates each halfword left.

Details

The Vector Rotate Left Halfword instruction rotates each halfword element of the source vector left by a specified number of bits determined by another vector's elements. The result is stored in the destination vector.

Pseudocode Operation

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

Programming Note

The vrlh instruction is commonly used for bit manipulation tasks that require rotating halfwords within a vector. Ensure that the source and destination vectors are properly aligned to avoid data corruption. This instruction operates at user privilege level, but if MSR.VEC is not set, it will raise a Vector_Unavailable exception. Performance may vary based on the specific implementation and the alignment of the input vectors.

Example

vrlh vd, va, vb

Encoding

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

Operands

  • vD
    Target
  • vA
    Data
  • vB
    Rotate Count