vmrglh

Vector Merge Low Halfword

vmrglh vD, vA, vB

Interleaves low-order halfwords.

Details

The Vector Merge Low Halfword instruction (vmrglh) merges the lower halfwords from two source vectors into a destination vector. It takes the lower halfwords from each of the two source vectors and interleaves them into the destination vector.

Pseudocode Operation

if MSR.VEC=0 then Vector_Unavailable()
do i = 0 to 3
   VSR[VRT+32].word[i].hword[0] ←VSR[VRA+32].hword[i+4]
   VSR[VRT+32].word[i].hword[1] ←VSR[VRB+32].hword[i+4]
end

Programming Note

The vmrglh instruction is used to merge the lower halfwords from two source vectors into a destination vector. Ensure that the Vector Facility (MSR.VEC) is enabled before using this instruction; otherwise, a Vector_Unavailable exception will be raised. The operation interleaves the halfwords from the two sources, so the resulting vector will have elements from both sources in an alternating pattern.

Example

vmrglh vd, va, vb

Encoding

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

Operands

  • vD
    Target
  • vA
    Src A
  • vB
    Src B