Operand 2 as a constant

You specify an Operand2 constant in the form:

#constant

where constant is an expression evaluating to a numeric value.

In ARM instructions, constant can have any value that can be produced by rotating an 8-bit value right by any even number of bits within a 32-bit word.

In Thumb instructions, constant can be:

Note

In the constants shown above, X and Y are hexadecimal digits.

In addition, in a small number of instructions, constant can take a wider range of values. These are detailed in the individual instruction descriptions.

When an Operand2 constant is used with the instructions MOVS, MVNS, ANDS, ORRS, ORNS, EORS, BICS, TEQ or TST, the carry flag is updated to bit[31] of the constant, if the constant is greater than 255 and can be produced by shifting an 8-bit value. These instructions do not affect the carry flag if Operand2 is any other constant.

Show/hideInstruction substitution

If a value of constant is not available, but its logical inverse or negation is available, then the assembler produces an equivalent instruction and inverts or negates constant.

For example, an assembler might assemble the instruction CMP Rd, #0xFFFFFFFE as the equivalent instruction CMN Rd, #0x2.

Be aware of this when comparing disassembly listings with source code.

You can use the --diag_warning 1645 assembler command line option to check when an instruction substitution occurs.

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