1

[MIPS]
Assume there is the stored value 0x12345678 in $s0.

Let's assume I want to put now another value into $s0 (say for example 0x87654321), then I have to put the value in two steps (at least I have learned it this way) with the lui operation and the ori.

lui $s0, 0x8765
ori $s0, $s0, 0x4321

I know this works if $s0 is 0 at the beginning, but I'm actually not sure if the lui operation sets the second half to 0's or if it just replaces the first half with my new input 0x8765.

So, my question is:
Does it work even if there's a stored value in $s0 or do I have to set the value of $s0 to 0 and then set the upper half and lower half ?

4

1 回答 1

4

您应该始终查阅有关此类问题的指令集参考。或者你甚至可以尝试一下。

但要回答你的问题,是lui的,清除低位。

于 2013-06-09T14:02:51.500 回答