← Home
CMP<cc> (vectors)
Compare vectors
This instruction compares Active integer elements in the
first source vector with the corresponding elements in the second source vector, and
places the boolean results of the specified
comparison in the corresponding elements of the destination
predicate. Inactive elements in the destination predicate register are set to zero. This instruction sets the First (N), None (Z), and !Last (C)
condition flags based on the predicate result,
and sets the V flag to zero.
This instruction is used by the pseudo-instructions CMPLE (vectors), CMPLO (vectors), CMPLS (vectors), and CMPLT (vectors).
It has encodings from 6 classes:
Equal
,
Greater than
,
Greater than or equal
,
Higher
,
Higher or same
and
Not equal
Equal class
(FEAT_SVE || FEAT_SME)
Decode
if !IsFeatureImplemented(FEAT_SVE) && !IsFeatureImplemented(FEAT_SME) then
EndOfDecode(Decode_UNDEF);
end;
let esize : integer{} = 8 << UInt(size);
let g : integer = UInt(Pg);
let n : integer = UInt(Zn);
let m : integer = UInt(Zm);
let d : integer = UInt(Pd);
let cmp_op : CmpOp = Cmp_EQ;
let unsigned : boolean = FALSE;
Greater than class
(FEAT_SVE || FEAT_SME)
Decode
if !IsFeatureImplemented(FEAT_SVE) && !IsFeatureImplemented(FEAT_SME) then
EndOfDecode(Decode_UNDEF);
end;
let esize : integer{} = 8 << UInt(size);
let g : integer = UInt(Pg);
let n : integer = UInt(Zn);
let m : integer = UInt(Zm);
let d : integer = UInt(Pd);
let cmp_op : CmpOp = Cmp_GT;
let unsigned : boolean = FALSE;
Greater than or equal class
(FEAT_SVE || FEAT_SME)
Decode
if !IsFeatureImplemented(FEAT_SVE) && !IsFeatureImplemented(FEAT_SME) then
EndOfDecode(Decode_UNDEF);
end;
let esize : integer{} = 8 << UInt(size);
let g : integer = UInt(Pg);
let n : integer = UInt(Zn);
let m : integer = UInt(Zm);
let d : integer = UInt(Pd);
let cmp_op : CmpOp = Cmp_GE;
let unsigned : boolean = FALSE;
Higher class
(FEAT_SVE || FEAT_SME)
Decode
if !IsFeatureImplemented(FEAT_SVE) && !IsFeatureImplemented(FEAT_SME) then
EndOfDecode(Decode_UNDEF);
end;
let esize : integer{} = 8 << UInt(size);
let g : integer = UInt(Pg);
let n : integer = UInt(Zn);
let m : integer = UInt(Zm);
let d : integer = UInt(Pd);
let cmp_op : CmpOp = Cmp_GT;
let unsigned : boolean = TRUE;
Higher or same class
(FEAT_SVE || FEAT_SME)
Decode
if !IsFeatureImplemented(FEAT_SVE) && !IsFeatureImplemented(FEAT_SME) then
EndOfDecode(Decode_UNDEF);
end;
let esize : integer{} = 8 << UInt(size);
let g : integer = UInt(Pg);
let n : integer = UInt(Zn);
let m : integer = UInt(Zm);
let d : integer = UInt(Pd);
let cmp_op : CmpOp = Cmp_GE;
let unsigned : boolean = TRUE;
Not equal class
(FEAT_SVE || FEAT_SME)
Decode
if !IsFeatureImplemented(FEAT_SVE) && !IsFeatureImplemented(FEAT_SME) then
EndOfDecode(Decode_UNDEF);
end;
let esize : integer{} = 8 << UInt(size);
let g : integer = UInt(Pg);
let n : integer = UInt(Zn);
let m : integer = UInt(Zm);
let d : integer = UInt(Pd);
let cmp_op : CmpOp = Cmp_NE;
let unsigned : boolean = FALSE;
Assembler Symbols
Operation
CheckSVEEnabled();
let VL : integer{} = CurrentVL();
let PL : integer{} = VL DIV 8;
let elements : integer = VL DIV esize;
let mask : bits(PL) = P{}(g);
let operand1 : bits(VL) = if AnyActiveElement{PL}(mask, esize) then Z{VL}(n) else Zeros{VL};
let operand2 : bits(VL) = if AnyActiveElement{PL}(mask, esize) then Z{VL}(m) else Zeros{VL};
var result : bits(PL);
let psize : integer{} = esize DIV 8;
for e = 0 to elements-1 do
let op1elt : bits(esize) = operand1[e*:esize];
let element1 : integer = if unsigned then UInt(op1elt) else SInt(op1elt);
if ActivePredicateElement{PL}(mask, e, esize) then
var cond : boolean;
let op2elt : bits(esize) = operand2[e*:esize];
let element2 : integer = if unsigned then UInt(op2elt) else SInt(op2elt);
case cmp_op of
when Cmp_EQ => cond = element1 == element2;
when Cmp_NE => cond = element1 != element2;
when Cmp_GE => cond = element1 >= element2;
when Cmp_LT => cond = element1 < element2;
when Cmp_GT => cond = element1 > element2;
when Cmp_LE => cond = element1 <= element2;
end;
let pbit : bit = if cond then '1' else '0';
result[e*:psize] = ZeroExtend{psize}(pbit);
else
result[e*:psize] = ZeroExtend{psize}('0');
end;
end;
PSTATE.[N,Z,C,V] = PredTest{PL}(mask, result, esize);
P{PL}(d) = result;
Operational information
This instruction is a data-independent-time instruction as described in About PSTATE.DIT.
If FEAT_SME is implemented and the PE is in Streaming SVE mode, then any subsequent instruction
that is dependent on the predicate register or NZCV condition flags written by this instruction might be significantly delayed.
Version 2026.09 — Copyright © 2010-2026 Arm Limited or its affiliates.
This site is provided as a community resource and is NOT affiliated with nor endorsed by Arm Limited.