UM10462
All information provided in this document is subject to legal disclaimers.
© NXP B.V. 2016. All rights reserved.
User manual
Rev. 5.5 — 21 December 2016
460 of 523
NXP Semiconductors
UM10462
Chapter 24: LPC11U3x/2x/1x Appendix ARM Cortex-M0
On the Cortex-M0 processor, conditional execution is available by using conditional
branches.
This section describes:
•
Section 24.4.3.6.1 “The condition flags”
•
Section 24.4.3.6.2 “Condition code suffixes”
.
24.4.3.6.1
The condition flags
The APSR contains the following condition flags:
N —
Set to 1 when the result of the operation was negative, cleared to 0 otherwise.
Z —
Set to 1 when the result of the operation was zero, cleared to 0 otherwise.
C —
Set to 1 when the operation resulted in a carry, cleared to 0 otherwise.
V —
Set to 1 when the operation caused overflow, cleared to 0 otherwise.
For more information about the APSR see
A carry occurs:
•
if the result of an addition is greater than or equal to 2
32
•
if the result of a subtraction is positive or zero
•
as the result of a shift or rotate instruction.
Overflow occurs when the sign of the result, in bit[31], does not match the sign of the
result had the operation been performed at infinite precision, for example:
•
if adding two negative values results in a positive value
•
if adding two positive values results in a negative value
•
if subtracting a positive value from a negative value generates a positive value
•
if subtracting a negative value from a positive value generates a negative value.
The Compare operations are identical to subtracting, for CMP, or adding, for CMN, except
that the result is discarded. See the instruction descriptions for more information.
24.4.3.6.2
Condition code suffixes
Conditional branch is shown in syntax descriptions as B{
cond
}. A branch instruction with a
condition code is only taken if the condition code flags in the APSR meet the specified
condition, otherwise the branch instruction is ignored. shows the condition codes to use.
also shows the relationship between condition code suffixes and the N, Z, C,
and V flags.
Table 426. Condition code suffixes
Suffix
Flags
Meaning
EQ
Z = 1
Equal, last flag setting result was zero
NE
Z = 0
Not equal, last flag setting result was non-zero
CS or HS
C = 1
Higher or same, unsigned
CC or LO
C = 0
Lower, unsigned
MI
N = 1
Negative