Cmp And Cmn - ST STM32H7 Series Programming Manual

Hide thumbs Also See for STM32H7 Series:
Table of Contents

Advertisement

The STM32 Cortex-M4 instruction set
Examples
CLZ R4,R9
CLZNE R2,R3
3.5.5

CMP and CMN

Compare and Compare Negative.
Syntax
CMP{cond} Rn, Operand2
CMN{cond} Rn, Operand2
Where:
'cond' is an optional condition code (see
'Rn' is the register holding the first operand.
'Operand2' is a flexible second operand (see
details of the options.
Operation
These instructions compare the value in a register with operand2. They update the condition
flags on the result, but do not write the result to a register.
The CMP instruction subtracts the value of operand2 from the value in Rn. This is the same
as a SUBS instruction, except that the result is discarded.
The CMN instruction adds the value of operand2 to the value in Rn. This is the same as an
ADDS instruction, except that the result is discarded.
Restrictions
In these instructions:
Do not use PC.
Operand2 must not be SP.
Condition flags
These instructions update the N, Z, C and V flags according to the result.
Examples
CMP R2, R9
CMN R0, #6400
CMPGT SP, R7, LSL #2
88/262
Conditional execution on page
Flexible second operand on page
PM0214 Rev 9
PM0214
65).
60) for

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the STM32H7 Series and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Table of Contents

Save PDF