vinserth
Vector Insert Halfword
vinserth vD, vB, UIM
Inserts a halfword from a GPR into a vector.
Encoding
Binary Layout
4
0:5
vD
6:10
UIM
11:15
vB
16:20
845
21:31
Operands
-
vD
Target Vector -
vB
Source GPR -
UIM
Index
Reference
View in PowerISA v3.1C Specification ↗
OPF Power ISA v3.1C
Description
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.
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.