Why didn't MIPS designers use the 5 remaining bits in R-format instructions for some other useful things?

江枫思渺然 提交于 2019-12-11 04:26:44

问题


In MIPS the R-format is encoded like this

opcode (6) | rs (5) | rt (5) | rd (5) | shamt (5) | funct (6) 

The shamt field is used only in shift or rotate instructions. In other cases it's always 0. So why couldn't they use it for other more useful things?

IMHO it'll be much better to use that field to store the register number that stores the carry/borrow in add or sub instructions. For example

addu $Rdest, $Rcarry, $Rsrc1, $Rsrc2

$Rcarry will only be set to 0 or 1 depending on the carry bit. That'll make it far more useful for multi-precision arithmetic. Architectures with a flag register can do a double-word addition in 2 instructions whereas MIPS needs 3 because the carry needs to be calculated in a separate instruction. Multiplications will also benefit from that because both the high and low of the output can be specified in the instruction itself instead of wasting several opcodes for the move from/to HI/LO registers

Similarly, the rs field is fixed at 0 for shift instructions. Why couldn't they use it for things like support for multi-word shifting like x86's shrd/shld? Or simply use those 5 bits in rs/shamt as a sub-opcode field. That'd vastly increase the opcode space. With that bigger space probably MIPSr6 wouldn't need a breaking change by removing some instructions to leave space for future expansion

来源:https://stackoverflow.com/questions/55597730/why-didnt-mips-designers-use-the-5-remaining-bits-in-r-format-instructions-for

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