EasyManua.ls Logo

ARM Cortex-M4 - CBZ and CBNZ

ARM Cortex-M4
276 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
The Cortex-M4 Instruction Set
ARM DUI 0553A Copyright © 2010 ARM. All rights reserved. 3-121
ID121610 Non-Confidential
3.10.2 CBZ and CBNZ
Compare and Branch on Zero, Compare and Branch on Non-Zero.
Syntax
CBZ Rn, label
CBNZ Rn, label
where:
Rn
Specifies the register holding the operand.
label
Specifies the branch destination.
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
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.
Condition flags
These instructions do not change the flags.
Examples
CBZ R5, target ; Forward branch if R5 is zero
CBNZ R0, target ; Forward branch if R0 is not zero

Table of Contents

Related product manuals