ARM > Introduction to ARM > Compare Instructions
Examples of Compare Instructions
CMP r0, #42
- Compare R0 to 42.
CMN r2, #42
- Compare R2 to -42.
TST r11, #1
- Test bit zero.
TEQ r8, r9
- Test R8 equals R9.
SUBS r1, r0, #42
- Compare R0 to 42, with result.
Remarks
CMP
is likeSUB
.CMN
is likeADD
– subtract of a negative number is the same as add.TST
is likeAND
.TEQ
is likeEOR
– exclusive or of identical numbers gives result of zero.
Previous topic:
Logical Instructions
Next topic:
Barrel Shifter