vmrghh

Vector Merge High Halfword

vmrghh vD, vA, vB

Merges the high halfwords of two vector registers into a target vector register.

Details

For vmrghh, the contents of halfword elements 0 to 3 of VSR[VRA+32] are placed into halfword elements 0 to 7 of VSR[VRT+32], and the contents of halfword elements 0 to 3 of VSR[VRB+32] are placed into halfword elements 1 to 8 of VSR[VRT+32].

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]
    VSR[VRT+32].word[i].hword[1] ← VSR[VRB+32].hword[i]

Programming Note

The vmrghh instruction is used to merge the high halfwords from two vector registers into a single destination register. Ensure that the Vector Facility (MSR.VEC) is enabled before using this instruction; otherwise, it will raise an exception. This operation is useful for combining data from two sources into one vector, but be cautious of alignment issues if the data elements are not properly aligned to halfword boundaries.

Example

vmrghh vd, va, vb

Encoding

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

Operands

  • vD
    Target
  • vA
    Src A
  • vB
    Src B
  • VRT
    Target Vector Register
  • VRA
    Source Vector Register
  • VRB
    Source Vector Register