ARM VERSION 1.2 manual CMP and CMN, Where Is the register containing the first operand

Models: VERSION 1.2

1 360
Download 360 pages 38.37 Kb
Page 220
Image 220

Thumb Instruction Reference

5.3.3CMP and CMN

Compare and Compare Negative.

Syntax

CMP Rn, #expr

 

CMP Rn, Rm

 

CMN Rn, Rm

 

where:

 

Rn

is the register containing the first operand.

expr

is an expression that evaluates (at assembly time) to an integer in the

 

range 0-255.

Rm

is a register containing the second operand.

Usage

These instructions update the condition flags, but do not place a result in a register. The CMP instruction subtracts the value of expr, or the value in Rm, from the value in Rn. The CMN instruction adds the values in Rm and Rn.

Restrictions

In CMP Rn,#expr, and CMN instructions, Rn and Rm must be in the range r0 to r7.

In CMP Rn,Rm instructions, Rn and Rm can be any register r0 to r15.

Condition flags

These instructions update the N, Z, C, and V flags according to the result.

Architectures

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

5-26

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

ARM DUI 0068B

Page 220
Image 220
ARM VERSION 1.2 manual CMP and CMN, Where Is the register containing the first operand