114
11100B–ATARM–31-Jul-12
SAM4S Series [Preliminary]
11.6.5.5
CMP and CMN
Compare and Compare Negative.
Syntax
CMP{cond} Rn, Operand2
CMN{cond} Rn, Operand2
where:
Operation
These instructions compare the value in a register with
Operand2
. They update the condition flags
on the result, but do not write the result to a register.
The
CMP
instruction subtracts the value of
Operand2
from the value in
Rn
. This is the same as a
SUBS
instruction, except that the result is discarded.
The
CMN
instruction adds the value of
Operand2
to the value in
Rn
. This is the same as an
ADDS
instruction, except that the result is discarded.
Restrictions
In these instructions:
• do not use PC
•
Operand2
must not be SP.
Condition Flags
These instructions update the N, Z, C and V flags according to the result.
Examples
CMP
R2, R9
CMN
R0, #6400
CMPGT
SP, R7, LSL #2
cond
is an optional condition code, see
.
Rn
is the register holding the first operand.
Operand2
is a flexible second operand. See
for details of the
options.
Summary of Contents for SAM4S Series
Page 44: ...44 11100B ATARM 31 Jul 12 SAM4S Series Preliminary ...
Page 412: ...412 11100B ATARM 31 Jul 12 SAM4S Series Preliminary ...
Page 1105: ...1105 11100B ATARM 31 Jul 12 SAM4S Series Preliminary ...
Page 1143: ...1143 11100B ATARM 31 Jul 12 SAM4S Series Preliminary Figure 43 4 64 lead LQFP Package Drawing ...
Page 1145: ...1145 11100B ATARM 31 Jul 12 SAM4S Series Preliminary Figure 43 5 64 lead QFN Package Drawing ...