
DR
AFT
DR
AFT
DRAFT
DR
D
RAFT
DRAFT
DRA
FT DRAF
D
RAFT DRAFT DRAFT DRAFT DRAFT D
DRAFT
D
RAFT DRA
FT DRAFT DRAFT DRAFT DRA
UM10360_0
© NXP B.V. 2009. All rights reserved.
User manual
Rev. 00.06 — 5 June 2009
677 of 808
NXP Semiconductors
UM10360
Chapter 34: Appendix: Cortex-M3 User Guide
2.9.2 CBZ and CBNZ
Compare and Branch on Zero, Compare and Branch on Non-Zero.
2.9.2.1
Syntax
CBZ
Rn
,
label
CBNZ
Rn
,
label
where:
Rn
is the register holding the operand.
label
is the branch destination.
2.9.2.2
Operation
Use the
CBZ
or
CBNZ
instructions to avoid changing the condition code flags and to reduce
the number of instructions.
CBZ Rn, label
does not change condition flags but is otherwise equivalent to:
CMP
Rn, #0
BEQ
label
CBNZ Rn, label
does not change condition flags but is otherwise equivalent to:
CMP
Rn, #0
BNE
label
2.9.2.3
Restrictions
The restrictions are:
•
Rn
must be in the range of
R0
to
R7
•
the branch destination must be within 4 to 130 bytes after the instruction
•
these instructions must not be used inside an IT block.
2.9.2.4
Condition flags
These instructions do not change the flags.
2.9.2.5
Examples
CBZ
R5, target ; Forward branch if R5 is zero
CBNZ
R0, target ; Forward branch if R0 is not zero