vmaxub

Vector Maximum Unsigned Byte

vmaxub vD, vA, vB

Selects maximum value per byte (unsigned).

Encoding

Binary Layout
4
0:5
vD
6:10
vA
11:15
vB
16:20
4
21:31
 
Format VA-form
Opcode 0x10000002
Extension VMX (AltiVec)

Operands

  • vD
    Target
  • vA
    Src A
  • vB
    Src B

Example

vmaxub vd, va, vb

Registers Altered

MSR

Related

More in VMX (AltiVec)

Reference

Description

Selects the maximum unsigned value for each corresponding byte pair from vA and vB, storing the results in vD. This is a vector operation that performs 16 independent byte-wise maximum comparisons in parallel. No condition flags or status fields are affected.

Operation

for i in 0 to 15 do
  vD[8*i:8*i+7] ← MAX_UNSIGNED(vA[8*i:8*i+7], vB[8*i:8*i+7])
end for

Programming Note

The vmaxub instruction is used to perform element-wise comparison of unsigned bytes from two vector registers and store the maximum values in a third register. Ensure that the Vector Facility (MSR.VEC) is enabled before using this instruction; otherwise, it will raise an exception. This instruction operates on 16-byte vectors, so ensure proper alignment for optimal performance.