Thumb Instruction Reference

Condition flags

MOV Rd,#expr and MVN instructions update the N and Z flags. They have no effect on the C or V flags.

NEG instructions update the N, Z, C, and V flags.

MOV Rd, Rm behaves as follows:

if either Rd or Rm is a high register (r8-r15), the flags are unaffected

if both Rd and Rm are low registers (r0-r7), the N and Z flags are updated, and C and V flags are cleared.

Note

You can use LSL, with a shift of zero, to move between low registers without clearing the C and V flags (see ASR, LSL, LSR, and ROR on page 5-24).

Architectures

These instructions are available in all T variants of the ARM architecture.

Examples

MOV r3,#0

MOV r0,r12 ; does not update flags

MVN r7,r1

NEG r2,r2

Incorrect examples

MOV r2,#256 ; immediate value out of range

MOV r8,#3 ; cannot move immediate to high register

MVN r8,r2 ; high registers not allowed with MVN or NEG

NEG r0,#3 ; immediate value not allowed with MVN or NEG

ARM DUI 0068B

Copyright © 2000, 2001 ARM Limited. All rights reserved.

5-29

Page 223
Image 223
ARM VERSION 1.2 manual Condition flags