开发者

Mips Assembly Language Convert C conditional

开发者 https://www.devze.com 2023-01-16 21:29 出处:网络
How to convert following C conditional statement in MIPS? if (A<=B || B开发者_StackOverflow中文版 == D)

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消