How to convert "or" to SPARC assembly? -


i'm trying convert following line sparc assembly (using negative logic):

if (i < || > b) {...} 

but i've stuck on how convert "or" bitwise or in sparc. , couldn't find helpful documentations convert this. can help? thank you.

(suppose i in $l0, a in $l1, , b in $l2 )

edit:

here have tried:

    cmp %l0, %l1 ! compare     bge end_if ! negative logic test end if statement     nop     cmp %l0, %l2 ! compare b     ble end_if ! negative logic test end if statement     nop if:     /*do something*/ end_if:     /*statements*/ 

the more specific question how use "or" between 2 cmp instructions? getting confusing me when using negative logic.

your code:

cmp %l0, %l1 ! compare bge end_if ! negative logic test end if statement nop cmp %l0, %l2 ! compare b ble end_if ! negative logic test end if statement nop if:     /*do something*/ end_if:     /*statements*/ 

is and. both sub-conditions must fulfilled, reach "do something" code. (a bit of boolean logic perhaps helps explaining: !(a ^ b) = !a v !b note: combining operation changes! )

for or, have use different logic:

test condition1 jump_if_true doit test condition2 jmp_if_true doit         ; *1) branch , jmp dont_doit            ; jmp can optimized  do_it:    /* if-part */    jmp endif dont_do_it    /* else-part */ endif: 

now optimized last 2 jumps one

test condition1 jump_if_true doit test condition2 jmp_if_not_true dont_doit         ; inverted remove 2nd jump  doit:    /* if-part */    jmp endif dont_doit    /* else-part */ endif: 

Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -