Conditional execution in ARM state

Almost all ARM instructions can be executed conditionally on the value of the ALU status flags in the APSR. You can either add a condition code suffix to the instruction or you can conditionally skip over the instruction using a conditional branch instruction.

Using conditional branches instructions to control the flow of execution can be better when a series of instructions depend on the same condition.

Example 17. Conditional instructions to control execution

    ; flags set by a previous instruction
    LSLEQ r0, r0, #24
    ADDEQ r0, r0, #2
    ;…

Example 18. Conditional branch to control execution

    ; flags set by a previous instruction
    BNE over
    LSL r0, r0, #24
    ADD r0, r0, #2
over
    ;…

Show/hideSee also

Copyright © 2010-2011 ARM. All rights reserved.ARM DUI 0473C
Non-ConfidentialID080411