I'm trying to convert the following line to SPARC assembly (using negative logic):
if (i < a || i > b) {...}
But I've stuck on how to convert "or" to bitwise or in SPARC. And I couldn't find helpful documentations to convert this. Can someone help? Thank you.
(suppose i
is in $l0
, a
is in $l1
, and b
is in $l2
)
EDIT:
Here is what I have tried:
cmp %l0, %l1 ! compare i with a
bge end_if ! negative logic test to end if statement
nop
cmp %l0, %l2 ! compare i with b
ble end_if ! negative logic test to end if statement
nop
if:
/*do something*/
end_if:
/*statements*/
The more specific question is that how to use a "or" between two cmp
instructions? This is getting very confusing to me when using negative logic.