MVN

From ARMwiki
(Difference between revisions)
Jump to: navigation, search
(Changed "SBZ" in instruction encoding to be zeros.)
(Fixed example, added note to clarify that the correct name (nowadays) is Move Negative.)
 
(One intermediate revision by one user not shown)
Line 2: Line 2:
 
| opcode = MVN
 
| opcode = MVN
 
| suffix = [S]
 
| suffix = [S]
| function = Move-not data into register
+
| function = Move-Negative data into register
 
| category = Data processing
 
| category = Data processing
 
| family = All
 
| family = All
Line 8: Line 8:
 
}}
 
}}
  
==MVN[S]==
+
==MVN[S] : Move Negative==
 
MVN will move the complement of the specified data into the specified register.
 
MVN will move the complement of the specified data into the specified register.
  
Line 16: Line 16:
  
 
'''''MVN''''' is useful for determining the complement of a value, and it is also a simple way to specify negative values (i.e. a [[SWI]] call wants -1 as a parameter).
 
'''''MVN''''' is useful for determining the complement of a value, and it is also a simple way to specify negative values (i.e. a [[SWI]] call wants -1 as a parameter).
 +
 +
===Move NOT?===
 +
You may be used to seeing this as "Move NOT", and I believe this is the ''original'' name of this instruction, as well as being quite descriptive of its behaviour.
 +
However MVN is referred to as ''Move Negative'' in official ARM documentation (ARM ARM 2nd ed; p A4-68) so this is the name that will be used here.
  
 
===Syntax===
 
===Syntax===
Line 24: Line 28:
  
 
===Example===
 
===Example===
   MVN  R0, #1         ; sets R0 to -1
+
   MVN  R0, #0         ; sets R0 to -1
 +
  MVN  R0, #1        ; sets R0 to -2
  
 
===Technical===
 
===Technical===

Latest revision as of 19:44, 21 June 2015

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

Contents

[edit] MVN[S] : Move Negative

MVN will move the complement of the specified 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 (MVNS), 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.

MVN is useful for determining the complement of a value, and it is also a simple way to specify negative values (i.e. a SWI call wants -1 as a parameter).

[edit] Move NOT?

You may be used to seeing this as "Move NOT", and I believe this is the original name of this instruction, as well as being quite descriptive of its behaviour. However MVN is referred to as Move Negative in official ARM documentation (ARM ARM 2nd ed; p A4-68) so this is the name that will be used here.

[edit] Syntax

  MVN<suffix>  <dest>, <op 1>

[edit] Function

  dest = (NOT op_1)

[edit] Example

  MVN  R0, #0         ; sets R0 to -1
  MVN  R0, #1         ; sets R0 to -2

[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 1 1 S 0 0 0 0 dest op/shift
Personal tools
Namespaces

Variants
Actions
Navigation
Contents
Toolbox