vinsertb

Vector Insert Byte from VSR using Immediate-specified Index

vinsertb vD, vB, UIM

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

Encoding

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

Operands

  • vD
    Target Vector
  • vB
    Source GPR
  • UIM
    Index
  • VRT
    Target Vector Register
  • VRB
    Source Vector Register
  • VX
    Target Vector Register
  • VS
    Source Vector Register
  • VI
    Immediate Value
  • IMM8
    8-bit Immediate Index

Example

vinsertb vd, vb, uim

Registers Altered

MSR

Related

More in VMX (AltiVec)

Reference

Description

The contents of byte element 7 of VSR[VRB+32] are placed into byte element UIM of VSR[VRT+32]. The remaining byte elements of VSR[VRT+32] are not modified.

Operation

if MSR.VEC=0 then
    Vector_Unavailable()
VRT[32].byte[UIM] ← VRB[32].byte[7]

Programming Note

This instruction is used to insert a byte from one vector register into another at a specified index. Ensure that the Vector Facility (MSR.VEC) is enabled; otherwise, a Vector Unavailable exception will be raised. The destination and source registers must be in the range of 32-63. Be cautious with alignment as it affects performance and correctness.