vinshvrx

Vector Insert Halfword from VSR using GPR-specified Right-Index VX-form

vinshvrx

Inserts a halfword from a vector register into another vector register at a position specified by a general-purpose register.

Details

Inserts a halfword-sized element from one vector register into another vector register at a byte position determined by the contents of a general-purpose register. This VMX (AltiVec) category instruction does not affect condition register or status fields. The GPR value specifies the insertion position within the destination vector.

Pseudocode Operation

index ← GPR value masked to valid range
VRD[index*8:(index+1)*16] ← halfword from VRS at position specified by index

Programming Note

The vinshvrx instruction is useful for selectively updating a halfword within a vector register based on a dynamic index provided by a general-purpose register. Ensure that the right-index specified in the GPR does not exceed the bounds of the 16-byte vector to avoid undefined behavior. This instruction operates at user privilege level and does not generate exceptions under normal circumstances, but incorrect indexing can lead to data corruption.

Example

vinshvrx

Encoding

Binary Layout
00101 001111
0
 
Format VX-form
Opcode 0x1000014F
Extension VMX (AltiVec)

Operands

  • VRT
    Target vector register where the halfword element is inserted.
  • VRA
    Source vector register containing the halfword value to be inserted.
  • RB
    General purpose register specifying the byte-position index for insertion into the target vector.