vinshlx

Vector Insert Halfword from GPR using GPR-specified Left-Index VX-form

vinshlx VRT,RA,RB

Inserts the high halfword of a general-purpose register into a vector register at a position specified by another general-purpose register.

Details

The contents of bits 48:63 of GPR[RB] are placed into byte elements index:index+1 of VSR[VRT+32], where index is the contents of bits 60:63 of GPR[RA].

Pseudocode Operation

if MSR.VEC=0 then
    Vector_Unavailable()
index ← GPR[RA].bit[60:63]
src.byte[0:15] ← 0
VSR[VRT+32].byte[index:index+1] ← GPR[RB].bit[48:63]

Programming Note

The vinshlx instruction is used to insert the upper halfword of a general-purpose register (GPR) into specific byte elements of a vector register. Ensure that the index specified in bits 60-63 of RA is within valid bounds to avoid undefined behavior. This instruction requires the Vector Facility to be enabled; otherwise, it will raise an exception.

Example

vinshlx v1, r4, r5

Encoding

Binary Layout
4
0
VRT
6
RA
11
RB
16
 
Format VX-form
Opcode 0x1000024F
Extension VMX (AltiVec)
Registers Altered None

Operands

  • VRT
    Target Vector Register
  • RA
    Source General Purpose Register (index)
  • RB
    Source General Purpose Register (data)