| |||

Home > ARM and Thumb Instructions > General data processing instructions > Operand 2 as a constant |

You specify an Operand2 constant in the form:

#`constant`

where

is
an expression evaluating to a numeric value.`constant`

In ARM instructions,

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.`constant`

In Thumb instructions,

can
be:`constant`

any constant that can be produced by shifting an 8-bit value left by any number of bits within a 32-bit word

any constant of the form

`0x00XY00XY`

any constant of the form

`0xXY00XY00`

any constant of the form

`0xXYXYXYXY`

.

In the constants shown above, `X`

and `Y`

are
hexadecimal digits.

In addition, in a small number of instructions,

can
take a wider range of values. These are detailed in the individual
instruction descriptions.`constant`

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.

If a value of 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`

,

`#0xFFFFFFFE`

`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.