You copied the Doc URL to your clipboard.

# Load immediate values using MOV and MVN

The `MOV` and `MVN` instructions can write a range of immediate values to a register.

In A32:

• `MOV` can load any 8-bit immediate value, giving a range of `0x0`-`0xFF` (0-255).

It can also rotate these values by any even number.

These values are also available as immediate operands in many data processing operations, without being loaded in a separate instruction.

• `MVN` can load the bitwise complements of these values. The numerical values are `-(n+1)`, where `n` is the value available in `MOV`.
• `MOV` can load any 16-bit number, giving a range of `0x0`-`0xFFFF` (0-65535).

The following table shows the range of 8-bit values that can be loaded in a single A32 `MOV` or `MVN` instruction (for data processing operations). The value to load must be a multiple of the value shown in the Step column.

Table 6-2 A32 state immediate values (8-bit)

Binary Decimal Step Hexadecimal MVN valuea Notes
`000000000000000000000000abcdefgh` 0-255 1 0-`0xFF` -1 to -256 -
`0000000000000000000000abcdefgh00` 0-1020 4 0-`0x3FC` -4 to -1024 -
`00000000000000000000abcdefgh0000` 0-4080 16 0-`0xFF0` -16 to -4096 -
`000000000000000000abcdefgh000000` 0-16320 64 0-`0x3FC0` -64 to -16384 -
... ... ... ... ... -
`abcdefgh000000000000000000000000` 0-255 x 224 224 0-`0xFF000000` 1-256 x -224 -
`cdefgh000000000000000000000000ab` (bit pattern) - - (bit pattern) See b in Note
`efgh000000000000000000000000abcd` (bit pattern) - - (bit pattern) See b in Note
`gh000000000000000000000000abcdef` (bit pattern) - - (bit pattern) See b in Note

The following table shows the range of 16-bit values that can be loaded in a single `MOV` A32 instruction:

Table 6-3 A32 state immediate values in MOV instructions

Binary Decimal Step Hexadecimal MVN value Notes
`0000000000000000abcdefghijklmnop` 0-65535 1 0-`0xFFFF` - See c in Note

### Note

These notes give extra information on both tables.
a

The `MVN` values are only available directly as operands in `MVN` instructions.

b

These values are available in A32 only. All the other values in this table are also available in 32-bit T32 instructions.

c

These values are not available directly as operands in other instructions.

In T32:

• The 32-bit `MOV` instruction can load:
• Any 8-bit immediate value, giving a range of `0x0`-`0xFF` (0-255).
• Any 8-bit immediate value, shifted left by any number.
• Any 8-bit pattern duplicated in all four bytes of a register.
• Any 8-bit pattern duplicated in bytes 0 and 2, with bytes 1 and 3 set to 0.
• Any 8-bit pattern duplicated in bytes 1 and 3, with bytes 0 and 2 set to 0.

These values are also available as immediate operands in many data processing operations, without being loaded in a separate instruction.

• The 32-bit `MVN` instruction can load the bitwise complements of these values. The numerical values are `-(n+1)`, where `n` is the value available in `MOV`.
• The 32-bit `MOV` instruction can load any 16-bit number, giving a range of `0x0`-`0xFFFF` (0-65535). These values are not available as immediate operands in data processing operations.

In architectures with T32, the 16-bit T32 `MOV` instruction can load any immediate value in the range 0-255.

The following table shows the range of values that can be loaded in a single 32-bit T32 `MOV` or `MVN` instruction (for data processing operations). The value to load must be a multiple of the value shown in the Step column.

Table 6-4 32-bit T32 immediate values

Binary Decimal Step Hexadecimal MVN valuea Notes
`000000000000000000000000abcdefgh` 0-255 1 `0x0`-`0xFF` -1 to -256 -
`00000000000000000000000abcdefgh0` 0-510 2 `0x0`-`0x1FE` -2 to -512 -
`0000000000000000000000abcdefgh00` 0-1020 4 `0x0`-`0x3FC` -4 to -1024 -
... ... ... ... ... -
`0abcdefgh00000000000000000000000` 0-255 x 223 223 `0x0`-`0x7F800000` 1-256 x -223 -
`abcdefgh000000000000000000000000` 0-255 x 224 224 `0x0`-`0xFF000000` 1-256 x -224 -
`abcdefghabcdefghabcdefghabcdefgh` (bit pattern) - `0xXYXYXYXY` `0xXYXYXYXY` -
`00000000abcdefgh00000000abcdefgh` (bit pattern) - `0x00XY00XY` `0xFFXYFFXY` -
`abcdefgh00000000abcdefgh00000000` (bit pattern) - `0xXY00XY00` `0xXYFFXYFF` -
`00000000000000000000abcdefghijkl` 0-4095 1 `0x0`-`0xFFF` - See b in Note

The following table shows the range of 16-bit values that can be loaded by the `MOV` 32-bit T32 instruction:

Table 6-5 32-bit T32 immediate values in MOV instructions

Binary Decimal Step Hexadecimal MVN value Notes
`0000000000000000abcdefghijklmnop` 0-65535 1 `0x0`-`0xFFFF` - See c in Note

### Note

These notes give extra information on the tables.
a

The `MVN` values are only available directly as operands in `MVN` instructions.

b

These values are available directly as operands in `ADD`, `SUB`, and `MOV` instructions, but not in `MVN` or any other data processing instructions.

c

These values are only available in `MOV` instructions.

In both A32 and T32, you do not have to decide whether to use `MOV` or `MVN`. The assembler uses whichever is appropriate. This is useful if the value is an assembly-time variable.

If you write an instruction with an immediate value that is not available, the assembler reports the error: ```Immediate n out of range for this operation.```