在 MIPS 中使用 $0 作为目的地的目的是什么
What is the purpose of using $0 as destination in MIPS
我在研究转发时检测危害的条件时,发现这句话很费解。
'In the event that an instruction in the pipeline has [=12=] as its
destination (for example, sll [=10=], , 2
), we want to avoid forwarding
its possibly nonzero result value.'
我以为寄存器$0不能写成不同的值,所以它的值一直是0。那么sll [=10=], , 2
有什么用,把$1的值左移2存入$0,哪些不能改变?那么 $0 作为目的地怎么可能与转发的需要相关呢?
"the need to forwarding"好像说明你不懂转发。这是一个优化。没有"need"去做。
优化不应影响语义。将值存储到 [=10=]
并随后读取 [=10=]
的值应该 return 0 按照通常的语义, 而不是 先前存储的值。然而转发会转发储值。
现在有一个问题,为什么[=10=]
可以用作商店位置。这只是具有正交指令集的 RISC 逻辑。在非 MIPS 架构上,这在某种程度上更有用,因为这些丢弃值操作仍然可以设置标志。
我在研究转发时检测危害的条件时,发现这句话很费解。
'In the event that an instruction in the pipeline has [=12=] as its destination (for example,
sll [=10=], , 2
), we want to avoid forwarding its possibly nonzero result value.'
我以为寄存器$0不能写成不同的值,所以它的值一直是0。那么sll [=10=], , 2
有什么用,把$1的值左移2存入$0,哪些不能改变?那么 $0 作为目的地怎么可能与转发的需要相关呢?
"the need to forwarding"好像说明你不懂转发。这是一个优化。没有"need"去做。
优化不应影响语义。将值存储到 [=10=]
并随后读取 [=10=]
的值应该 return 0 按照通常的语义, 而不是 先前存储的值。然而转发会转发储值。
现在有一个问题,为什么[=10=]
可以用作商店位置。这只是具有正交指令集的 RISC 逻辑。在非 MIPS 架构上,这在某种程度上更有用,因为这些丢弃值操作仍然可以设置标志。