How does a negated compare work?

  • Thread starter Thread starter Ian_Brooks
  • Start date Start date
  • Tags Tags
    Compare Work
Join the discussion
Registration is free. Start your own thread to ask a follow-up.
2 replies · 4K views
Ian_Brooks
Messages
127
Reaction score
0

Homework Statement



I understand that in the ARM architecture
CMP a1, a2

will take the difference between a1 and a2 and make a decision based on its flags
NZCV - if the difference is positive a1 > a2, and vice versa

But how does a negated cmp work?

CMN a1, a2 ?

Is it the opposite?


Homework Equations





The Attempt at a Solution



see above. the internet gives me nothing
 
Physics news on Phys.org
thanks for the link -

If
cmp a1, a2 ; performs a subtraction
cmn a1, a2 ; performs a subtration with the second opperand being negative or
...;a1-(-a2) so its the same as an add, so what's the benefit of using cmn besides branching?
 
Last edited: