vsplth
Vector Splat Halfword
vsplth vD, vB, UIM
Duplicates a halfword element across the vector.
Encoding
Binary Layout
4
0:5
vD
6:10
UIM
11:15
vB
16:20
588
21:31
Operands
-
vD
Target -
vB
Source -
UIM
Index
Example
vsplth vd, vb, uim
Related
More in VMX (AltiVec)
Reference
View in PowerISA v3.1C Specification ↗
OPF Power ISA v3.1C
Description
Splats (replicates) a single halfword element from vB across all 8 halfword elements of vD. The halfword element selected is determined by the 3-bit unsigned immediate UIM (where UIM=0 selects halfword 0, UIM=7 selects halfword 7 in big-endian order). No status flags are affected. This is a VMX/AltiVec instruction.
Operation
index ← UIM
vD ← replicate(vB[index*16:index*16+15] to all 8 halfword positions)
Programming Note
The vsplth instruction is commonly used when you need to replicate a specific halfword from a source vector into all elements of a destination vector, which is useful for operations requiring uniform operands. Ensure the specified bit position (b) is within the valid range to avoid undefined behavior. This instruction operates at user privilege level and does not generate exceptions under normal circumstances.