Assembler User GuidePreface Overview of the Assembler Overview of the ARM Architecture Structure of Assembly Language Modules Writing ARM Assembly Language Condition Codes Conditional instructions Conditional execution in ARM state Conditional execution in Thumb state Updates to the condition flags Condition code suffixes and related flags Comparison of condition code meanings in integer a Benefits of using conditional execution Example showing the benefits of using conditional Optimization for execution speed Using the Assembler Symbols, Literals, Expressions, and Operators VFP Programming Assembler Command-line Options ARM and Thumb Instructions VFP Instructions Directives Reference Via File Syntax
Updates to the condition flags
5.4 Updates to the condition flags
Most ARM and Thumb data processing instructions only update the condition flags if you append an S suffix to the mnemonic. These instructions can update all or a subset of the flags.
In ARM state, and in Thumb state on ARMv6T2 or later processors, most data processing instructions have an option to update the condition flags in the Application Program Status Register (APSR) according to the result of the operation. Instructions with the optional S suffix update the flags. Conditional instructions that are not executed have no effect on the flags.
In Thumb state on processors before ARMv6T2, most data processing instructions update the condition flags automatically according to the result of the operation. There is no option to leave the flags unchanged and not update them. Other instructions cannot update the flags.
The instruction also determines the flags that get updated. Some instructions update all flags, and some instructions only update a subset of the flags. If a flag is not updated, the original value is preserved. The description of each ARM and Thumb instruction includes the effect it has on the flags.
NoteMost instructions update the condition flags only if the S suffix is specified. The instructions
The condition flags are held in the APSR. They are set or cleared as follows:
C is set in one of the following ways:
Overflow occurs if the result of a signed add, subtract, or compare is greater than or equal to 231, or less than –231.
of your data.