vinserth

Vector Insert Halfword

vinserth vD, vB, UIM

Inserts a halfword from a GPR into a vector.

Details

Inserts the low-order 16 bits of general-purpose register vB into vD at the halfword position specified by UIM, leaving other halfword elements of vD unchanged. The halfword index (0–7) is provided by the 3-bit immediate UIM. No status flags are affected. This instruction is part of the VMX (AltiVec) extension.

Pseudocode Operation

index ← UIM[1:3]
vD[index*16 : index*16+15] ← vB[48:63]

Programming Note

The vinserth instruction is used to insert a halfword from one vector register into another at a specified index. Ensure that the Vector Facility (MSR.VEC) is enabled; otherwise, a Vector_Unavailable exception will be raised. The destination vector's remaining byte elements remain unchanged after the insertion.

Example

vinserth vd, vb, uim

Encoding

Binary Layout
4
0
vD
6
UIM
11
vB
16
845
21
 
Format VX-form
Opcode 0x1000034D
Extension VMX (AltiVec)
Registers Altered MSR

Operands

  • vD
    Target Vector
  • vB
    Source GPR
  • UIM
    Index