Why isn't MIPS BLT instruction implemented in hardware?

…衆ロ難τιáo~ 提交于 2020-01-05 09:21:24

问题


I'd like to ask why the BLT instruction is not a part of MIPS ISA. Instead they actually make it a pseudo-instruction for assembly programmers. I just couldn't recognize the difference between BLT and BLTZ (which is a part of MIPS ISA) from hardware implementation point of view.

By the way the book "Computer Organization and Design" says :

Heeding von Neumann's warning about the simplicity of the "equipment" the MIPS architecture doesn't include branch on less than because it's too complicated either it would stretch the clock cycle time or it would take extra clock cycles per instruction, the two faster instructions are more useful.

But I still have no idea why those might happen.


回答1:


It's much easier to compare with zero

Because less than zero is really just a sign bit check while less than is a subtract and then jump based on the sign bit of the result. Therefore BLTZ is much faster. Similarly, >= 0 also needs only 1 sign bit check. <= 0 or > 0 need another zero check but it's rather trivial.

In fact, it's not common that an architecture supports jump-and-compare between two values directly in a single instruction, although most will have jumps based on the value in relation to 0. Even CISC architectures like x86 require the user to compare and then jump



来源:https://stackoverflow.com/questions/19923977/why-isnt-mips-blt-instruction-implemented-in-hardware

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!