xxinsertw

VSX Vector Insert Word

xxinsertw XT, RB, UIM

Inserts a 32-bit word from a GPR into a specific element of a VSR.

Encoding

Binary Layout
60
0:5
XT
6:10
UIM
11:15
RB
16:20
181
21:31
 
Format XX2-form
Opcode 0xF00002D4
Extension VSX

Operands

  • XT
    Target VSR
  • RB
    Source GPR
  • UIM
    Element Index

Example

xxinsertw vs1, r5, uim

Registers Altered

MSR

Related

More in VSX

Reference

Description

Inserts a 32-bit word from GPR RB into a specified 32-bit element of VSR XT, with the element index selected by UIM[2:0]. This is a VSX instruction that operates on vector data and does not affect condition registers or status fields.

Operation

element_index ← UIM[2:0]
XT[32*element_index : 32*element_index+31] ← RB[32:63]

Programming Note

The xxinsertw instruction is used to insert a word from one vector register into another at a specified byte offset. Ensure that the UIM (Upper Immediate) field does not exceed 12 to avoid undefined behavior. This instruction requires VSX (Vector Scalar Extensions) to be enabled in the MSR.VSX bit; otherwise, it will raise an exception.