Mips Assembly Language Convert C conditional
How to convert following C conditional statement in MIPS? if (A<=B || B开发者_StackOverflow中文版 == D) where suppose A is stored in $t2, B in $t4, D in $t6
Some pointers
Compare A and B using sltu
or slt
instruction (they are not the interchangeable). If the condition is satisfied, then that's all (lazyness). Its probably easier using these instructions to check if B < A
act on that.
If not, compare B and D using the bneq
or beq
instruction. Choose one whether you want to fallthrough or branch to the if's
body.
精彩评论