4.8.2. CBZ and CBNZ

Compare and Branch on Zero, Compare and Branch on Non-Zero.

Note

These are Thumb-2 16-bit instructions.

Syntax

CBZ Rn, label
CBNZ Rn, label

where:

Rn

is the register holding the operand.

label

is the branch destination.

Usage

You can use the CBZ or CBNZ instructions to save one instruction in compare with zero and branch code sequences.

Except that it does not change the condition code flags, CBZ Rn, label is equivalent to:

    CMP     Rn, #0
    BEQ     label

Except that it does not change the condition code flags, CBNZ Rn, label is equivalent to:

    CMP     Rn, #0
    BNE     label

Restrictions

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.

Architectures

These 16-bit Thumb-2 instructions are available in T2 variants of ARMv6 and above.

Copyright © 2002-2005 ARM Limited. All rights reserved.ARM DUI 0204F
Non-Confidential