vpkuhus

Vector Pack Unsigned Halfword Unsigned Saturate

vpkuhus vD, vA, vB

Saturates 8 halfwords to 16 unsigned bytes.

Details

The vpkuhus instruction packs unsigned halfwords from two source vectors into a destination vector, performing unsigned saturation if necessary.

Pseudocode Operation

if MSR.VEC=0 then Vector_Unavailable()
vsrc.qword[0] ← VSR[VRA+32]
vsrc.qword[1] ← VSR[VRB+32]
do i = 0 to 15
   VSR[VRT+32].byte[i] ← ui8_CLAMP(EXTZ(vsrc.hword[i]))
end

Programming Note

The vpkuhus instruction is used to pack unsigned halfwords from two source vectors into a destination vector, with saturation applied if the values exceed 8 bits. Ensure that the Vector Facility (MSR.VEC) is enabled before using this instruction; otherwise, it will raise an exception. The operation processes each halfword from the input vectors and clamps the result to fit within an 8-bit unsigned integer range.

Example

vpkuhus vd, va, vb

Encoding

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

Operands

  • vD
    Target
  • vA
    Src A
  • vB
    Src B