CMP and CMN
Compare and Compare Negative.
Syntax
CMP{cond} Rn, Operand2
CMN{cond} Rn, Operand2
where:
cond
is an optional condition code.
Rn
is the register holding the first operand.
Operand2
is a flexible second operand.
Operation
These instructions compare the value in a register with Operand2. They update the condition flags on the
result, but do not place the result in any 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.
Rn - Operand2
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.
Rn + Operand2
In certain circumstances, the assembler can substitute CMN for CMP, or CMP for CMN. Be aware of this when
reading disassembly listings.
本文深入探讨了ARM汇编语言中的CMP(比较)和CMN(负数比较)指令的语法与操作原理。CMP指令通过从寄存器Rn中减去Operand2来比较两个值,而CMN指令则通过将Operand2加到Rn中进行比较。两种指令都会更新条件标志,但不会将结果保存到任何寄存器中。
1715

被折叠的 条评论
为什么被折叠?



