I'm trying to get a grip on conditional execution within ARM programming.
So I kind of understand a situation like this:
if ( (R0 != 5) || (R2 != R3) ) ; != means not equal, || mean OR
{
R4-- ; // R4 = R4 - 1
}
And the ARM version of this would be:
CMP R0, 5
CMPEQ R2, R3
SUBNE R4, R4, 1
I was curious how ARM knows that that is an "OR" (||). So it does two compares. But what happens if both compares aren't correct. Is that what NE does? What happens if they were different (like example below).
So lets say the code is this:
if ( (R0 > 5) && (R2 != R3) ) ; != means not equal, && mean AND
{
R4-- ; // R4 = R4 - 1
}
How would you write this with conditional instructions in ARM?
Thanks!
R4--when any of the 2 conditions is given (like you'd do with || ) - Tommylee2k&&first. But if the second half involved dereferencing a pointer, it might be NULL so you shouldn't write asm that dereferences it when the C doesn't.) - Peter Cordes