vcmpgtub
Vector Compare Greater Than Unsigned Byte
Unsigned > comparison for 16 bytes.
Details
The vcmpgtub instruction compares each byte of two source vectors as unsigned integers. If a byte in the first source vector is greater than the corresponding byte in the second source vector, the corresponding byte in the result vector is set to all 1s (0xFF). Otherwise, it is set to all 0s (0x00). The instruction also updates CR field 6 if Rc=1 to indicate whether all elements compared true and whether all elements compared false.
Pseudocode Operation
if MSR.VEC=0 then Vector_Unavailable()
all_true ←1
all_false ←1
do i = 0 to 15
src1 ←EXTZ(VSR[VRA+32].byte[i])
src2 ←EXTZ(VSR[VRB+32].byte[i])
if src1 > src2 then do
VSR[VRT+32].byte[i] ←0xFF
all_false ←0
end
else do
VSR[VRT+32].byte[i] ←0x00
all_true ←0
end
end
if Rc=1 then
CR.field[6] ←all_true || 0b0 || all_false || 0b0
Programming Note
vcmpgtub is useful for comparing unsigned byte values in vectors. Ensure both source vectors are properly aligned to avoid alignment faults. The instruction updates CR field 6 if Rc=1, indicating comparison results; check this for conditional logic. Performance may vary based on vector length and data distribution.
Example
Encoding
Operands
-
vD
Target -
vA
Src A -
vB
Src B