vslh

Vector Shift Left Halfword

vslh vD, vA, vB

Shifts each halfword left.

Details

The Vector Shift Left Halfword instruction shifts each halfword element of the source vector left by a specified number of bits. The shift amount is taken from the third operand vector.

Pseudocode Operation

if MSR.VEC=0 then Vector_Unavailable()
do i = 0 to 1
   src1.hword[0] ←VSR[VRA+32].hword[i]
   src1.hword[1] ←VSR[VRA+32].hword[i]
   n ←VSR[VRB+32].bit[57:63]
   r ←src1.bit[n:n+15]
   m ←MASK(b, e)
   VSR[VRT+32] ←(r & m) | (VSR[VRT+32] & ¬m)

Programming Note

The vslh instruction shifts each halfword element of the source vector left by a specified number of bits. Ensure that the shift amount is within the valid range to avoid unexpected results. This instruction operates at the user privilege level and does not generate exceptions under normal conditions.

Example

vslh vd, va, vb

Encoding

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

Operands

  • vD
    Target
  • vA
    Data
  • vB
    Shift