MOV
From ARMwiki
Instruction | MOV[S] |
---|---|
Function | Move data into register |
Category | Data processing |
ARM family | All |
Notes | - |
Contents |
MOV[S] : Move
MOV will move data into the specified register.
Operand 1 may be another register, a shifted register, or an immediate value (which may be shifted).
If the S bit is set (MOVS), the N and Z flags are set according to the value moved (after shifting, if shifter used), and the C flag is set by the shifter.
MOV is useful for transferring the contents of registers, setting registers prior to specific operations, perform a shift without requiring more complicated maths (LSL #x to multiply by 2x), update PC to return after a subroutine (the infamous MOV PC, LR
).
Use MVN to place negative values into registers.
Syntax
MOV<suffix> <dest>, <op 1>
Function
dest = op_1
Example
MOV R0, R0 ; equivalent to a NOP MOV R0, R0, LSL#3 ; R0 = R0 * 8
Technical
The instruction bit pattern is as follows:
31 - 28 | 27 | 26 | 25 | 24 - 21 | 20 | 19 - 16 | 15 - 12 | 11 - 0 |
---|---|---|---|---|---|---|---|---|
condition | 0 | 0 | I | 1 1 0 1 | S | 0 0 0 0 | dest | op/shift |