Cbz And Cbnz - ST STM32F3 Series Programming Manual

Hide thumbs Also See for STM32F3 Series:
Table of Contents

Advertisement

The STM32 Cortex-M4 instruction set
BLX
3.9.6

CBZ and CBNZ

Compare and Branch on Zero, Compare and Branch on Non-Zero.
Syntax
CBZ Rn, label
CBNZ Rn, label
Where:
'Rn' is the register holding the operand.
'label' is 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
BEQ
CBNZ Rn, label does not change condition flags but is otherwise equivalent to:
CMP
BNE
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
CBNZ
144/262
R0
; Branch with link and exchange (Call) to a address stored
; in R0
Rn, #0
label
Rn, #0
label
R5, target ; Forward branch if R5 is zero
R0, target ; Forward branch if R0 is not zero
PM0214 Rev 10
PM0214

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the STM32F3 Series and is the answer not in the manual?

Questions and answers

Table of Contents