Comparison
|
CMN<suffix> <op 1>, <op 2> status = op_1 - (- op_2)
CMN
is the same as CMP
, except it allows you to compare against small
negative values (the logical NOT of operand two) that would be hard to implement otherwise; such
as -1 to end a list.CMN R0, #1 ; Compare R0 with -1Refer also to the details for the
CMP
instruction.
CMP<suffix> <op 1>, <op 2> status = op_1 - op_2
CMP
allows you to compare the contents of a register with another register or an
immediate value, updating the status flags to allow conditional execution to take place.S
suffix as the point of the
command is to update the status flags... If you do specify it, it will be ignored.
TEQ<suffix> <op 1>, <op 2> Status = op_1 EOR op_2
TEQ
is similar to TST
. The difference is that the notional arithmetical
calculation is an EOR rather than an AND.CMP
).TEQ
is also used with the P
suffix to alter the flags in R15 (in 26-bit
mode). Refer to psr.html for more details, or
go here for how to do it in 32-bit mode.
TST<suffix> <op 1>, <op 2> Status = op_1 AND op_2
TST
, like CMP
, does not produce a result to be placed into a
destination register. Instead it performs an operation on the two operands given and reflects
the result of this in the status flags.TST
is used to see if a particular bit is set. Operand one is the data word to
test and operand two is a bit mask. After testing, the Zero flag will be set upon a match, or
otherwise clear.CMP
, it does not matter if you specify the S
suffix or not.
TST R0, #%1 ; Test if bit zero is set in R0