0

I have a confusion regarding BLT instruction
Consider the following snippet:

label  
.  
.  
.  
CMP r2,r3  
BLT label

Now, as per the answer of this post: ARM Assembler - How do I use CMP, BLT and BGT? (from Leo); branching to label will take place if r2 < r3
But, why the branching is taking place when r2 = 0x82000000 and r3= 0x0 ?
can anyone please explain

I set r3= 0x82000000 and then, branching was not happening
but for r3= 0x0 , how branching is happening?

Bittu
  • 33
  • 4
  • 3
    `0x82000000` is a negative 2's complement integer; note that the high bit (sign bit) is set. If you want an unsigned condition, use `bhi` or `blo`. – Peter Cordes Nov 15 '22 at 09:58
  • read the arm documentation it indicates signed and unsigned comparisons so if you want signed less than then you use one instruction if you want unsigned you us another, repeat for greater than and the or equal versions...(or reverse the operands and just use gt or lt) – old_timer Nov 15 '22 at 15:36
  • this is true for all instruction sets not just arm, you have to be aware if the comparison is signed or unsigned, for one version you can just use the carry bit if you understand (a few minutes of addition with pencil and paper and some four bit numbers). – old_timer Nov 15 '22 at 15:38

0 Answers0