vinsertw

Vector Insert Word from VSR using Immediate-specified Index

vinsertw vD, vB, UIM

Inserts a word element from one vector register into another vector register at an immediate-specified index.

Encoding

Binary Layout
4
0:5
vD
6:10
UIM
11:15
vB
16:20
909
21:31
 
Format VX-form
Opcode 0x1000038D
Extension VMX (AltiVec)

Operands

  • vD
    Target Vector
  • vB
    Source GPR
  • UIM
    Index
  • VRT
    Target Vector Register
  • VRB
    Source Vector Register

Example

vinsertw vd, vb, uim

Registers Altered

MSR

Related

More in VMX (AltiVec)

Reference

Description

The contents of word element 1 of VSR[VRB+32] are placed into byte elements UIM:UIM+3 of VSR[VRT+32]. The contents of the remaining byte elements of VSR[VRT+32] are not modified. If the value of UIM is greater than 12, the results are undefined.

Operation

if MSR.VEC=0 then
    Vector_Unavailable()
VSR[VRT+32].byte[UIM:UIM+3] ← VSR[VRB+32].word[1]

Programming Note

This instruction is used to insert a word from one vector register into another, with the destination index specified by an immediate value. Ensure that the immediate index (UIM) does not exceed 12 to avoid undefined behavior. This operation requires the Vector Facility to be enabled in the Machine State Register (MSR).