变量如何在 MIPS 上的 Add 命令上工作
我有一个我无法理解的任务 我必须在 C 中编写 2 个 Mips 代码
a)
1.Add f,g,h
b)
- Addi f,f,1
- Add f,g,h
我的问题是 (b) 这是否意味着 f = ( f+1) + (g+h) 或 f = g + h 我不明白第一行是否被第二行覆盖,这使得 (a) 和 (b) 上的代码相同
谢谢您的时间
i have a task which i cannot understand
There are 2 Mips codes which i have to write in C
a)
1.Add f,g,h
b)
- Addi f,f,1
- Add f,g,h
My question is on (b) Does this mean that f = (f+1) + (g+h) or f = g + h
I don't understand if the first line is overwriten by the second which makes the codes on (a) and (b) the same
Thank you for your time
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
addi f, f, 1
表示f = f + 1
,add f, g, h
表示f = g + h
。第二条指令将覆盖第一条指令中生成的
f
值,因此第一条指令没有实际效果(除了消耗时间和能量),除非符号f
具有被定义为与g
或h
相同的寄存器。addi f, f, 1
meansf = f + 1
, andadd f, g, h
meansf = g + h
.The second instruction will overwrite the value of
f
produced in the first instruction, so the first instruction has no net effect (other than consuming time and energy) unless the symbolf
has been defined to be the same register asg
orh
.