Difference between load word and move?

扶醉桌前 提交于 2019-12-08 16:39:08

问题


What is the difference between

ldw r8,0(r4)

and

mov r8, r4

Load word says "copy from memory" but when load word copies from r4, it is copying from register and not from memory right?


回答1:


The lw instruction (I assume that's what you meant since ldw isn't a standard MIPS instruction, though all the loads will be similar in the context of this answer) loads a word from the memory address specified by 0 + r4, while move1 simply transfers the value of r4 into r8.

For example, let's say r4 is currently 1234 and the word stored at 1234 in memory is 5678.

The difference is thus:

move r8, r4            ; r8 is now 1234
lw   r8, 0(r4)         ; r8 is now 5678

1 The move instruction" is actually a pseudo-instruction where move $rt, $rs is encoded as addi $rt, $rs, 0.



来源:https://stackoverflow.com/questions/12155118/difference-between-load-word-and-move

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