13.24 CBZ and CBNZ

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

Syntax

CBZ{q} Rn, label

CBNZ{q} Rn, label

where:

q
Is an optional instruction width specifier.
Rn
Is the register holding the operand.
label
Is the branch destination.

Usage

You can use the CBZ or CBNZ instructions to avoid changing the condition flags and to reduce the number of instructions.

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

    CMP     Rn, #0
    BEQ     label

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

    CMP     Rn, #0
    BNE     label

Restrictions

The branch destination must be a multiple of 2 in the range 0 to 126 bytes after the instruction and in the same execution state.

These instructions must not be used inside an IT block.

Condition flags

These instructions do not change the flags.

Architectures

These 16-bit instructions are available in Arm®v7‑A T32, Armv8‑A T32, and Armv8‑M only.

There are no Armv7‑A A32, or Armv8‑A A32 or 32-bit T32 encodings of these instructions.

Non-ConfidentialPDF file icon PDF versionDUI0801J
Copyright © 2014–2017, 2019 Arm Limited or its affiliates. All rights reserved.