From ARMwiki
(Difference between revisions)
Jump to: navigation, search
m (Changed "SBZ" in instruction encoding to be zeros.)
(Added more descriptive title.)
Line 8: Line 8:
==MOV[S] : Move==
MOV will move data into the specified register.
MOV will move data into the specified register.

Latest revision as of 08:03, 22 December 2011

Instruction MOV[S]
Function Move data into register
Category Data processing
ARM family All
Notes -


[edit] 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.

[edit] Syntax

  MOV<suffix>  <dest>, <op 1>

[edit] Function

  dest = op_1

[edit] Example

  MOV  R0, R0         ; equivalent to a NOP
  MOV  R0, R0, LSL#3  ; R0 = R0 * 8

[edit] 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
Personal tools