1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

How does a negated compare work?

  1. Oct 21, 2007 #1
    1. The problem statement, all variables and given/known data

    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?


    2. Relevant equations



    3. The attempt at a solution

    see above. the internet gives me nothing
     
  2. jcsd
  3. Oct 22, 2007 #2
    CMP means Compare values
    CMN means Compare Negated values

    The ARM instruction sets are widely published, but here is a link to a help page

    http://www.heyrick.co.uk/assembler/cmp.html#cmn
    I am sure you will be able to figure it out from there.
     
    Last edited: Oct 22, 2007
  4. Oct 23, 2007 #3
    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 whats the benefit of using cmn besides branching?
     
    Last edited: Oct 23, 2007
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: How does a negated compare work?
Loading...