vmrglw

Vector Merge Low Word

vmrglw vD, vA, vB

Interleaves low-order words.

Details

Merges the two low-order (rightmost) words from vA and vB in an alternating interleaved pattern into vD, with vA word in even position and vB word in odd position. This VMX instruction does not affect any condition or status registers.

Pseudocode Operation

vD[0:31] ← vA[96:127]
vD[32:63] ← vB[96:127]
vD[64:95] ← vA[64:95]
vD[96:127] ← vB[64:95]

Programming Note

The vmrglw instruction is used to merge the low words from two source vectors into a destination vector. Ensure that the Vector Facility (VEC) bit in the Machine State Register (MSR) is set; otherwise, a Vector_Unavailable exception will be raised. This instruction operates on 128-bit vector registers and requires proper alignment of the input vectors to avoid unexpected results.

Example

vmrglw vd, va, vb

Encoding

Binary Layout
4
0
vD
6
vA
11
vB
16
396
21
 
Format VX-form
Opcode 0x1000018C
Extension VMX (AltiVec)
Registers Altered MSR

Operands

  • vD
    Target
  • vA
    Src A
  • vB
    Src B