vcmpequb

Vector Compare Equal Byte

vcmpequb VRT,VRA,VRB
vcmpequb. VRT,VRA,VRB

Compares two vector registers element by element as unsigned bytes and sets the target vector register based on the comparison.

Details

The Vector Integer Compare instructions compare two VSRs element by element, interpreting the elements as unsigned or signed integers depending on the instruction, and set the corresponding element of the target VSR to all 1s if the relation being tested is true and to all 0s if the relation being tested is false.

Pseudocode Operation

if MSR.VEC=0 then Vector_Unavailable()
all_true ←1
all_false ←1
do i = 0 to 15
    src1 ←VSR[VRA+32].byte[i]
    src2 ←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

vcmpequb[.], vcmpequh[.], vcmpequw[.], and vcmpequd[.] can be used for unsigned or signed integers.

Example

vcmpequb v1, v2, v3

Encoding

Binary Layout
18
0
VRT
6
VRA
11
VRB
16
Rc
21
 
Format VC-form
Opcode 0x10000006
Extension VMX (AltiVec)
Registers Altered CR6

Operands

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