vsplth

Vector Splat Halfword

vsplth vD, vB, UIM

Duplicates a halfword element across the vector.

Details

The Vector Splat Halfword instruction (vsplth) replicates a specified halfword from the source vector register into all elements of the destination vector register. This is useful for preparing vectors where one operand needs to be consistent across all elements, such as in arithmetic operations with a constant.

Pseudocode Operation

b ← UIM || 0b0000
do i = 0 to 7
   VSR[VRT+32].hword[i] ← VSR[VRB+32].bit[b:b+15]
end

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.

Example

vsplth vd, vb, uim

Encoding

Binary Layout
4
0
vD
6
UIM
11
vB
16
588
21
 
Format VX-form
Opcode 0x1000024C
Extension VMX (AltiVec)

Operands

  • vD
    Target
  • vB
    Source
  • UIM
    Index