title: What's the difference between the CMP and TST instructions in ARM?
body: <p>I'm having trouble understanding the difference between these two instructions in ARM. From what I understand, </p>
  
  <pre><code>CMP R1, R2
  </code></pre>
  
  <p>Would perform the action R1-R2, but not store the result. It would then set flags in the status register such as N (negative, if R1
  
  <p>What I don't get is what TST does differently. In my notes it says that TST doesn't change the values of its operands.. but I thought CMP didn't either. How do the two instructions differ? </p>
  
  <p>How is </p>
  
  <pre><code>CMP R1, R2
  </code></pre>
  
  <p>different to </p>
  
  <pre><code>TST R1, R2
  </code></pre>
  
  <p>? Thanks in advance for any help!</p>