变量如何在 MIPS 上的 Add 命令上工作

发布于 2025-01-17 05:22:05 字数 241 浏览 0 评论 0原文

我有一个我无法理解的任务 我必须在 C 中编写 2 个 Mips 代码

a)

1.Add f,g,h

b)

  1. Addi f,f,1
  2. 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)

  1. Addi f,f,1
  2. 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

骑趴 2025-01-24 05:22:05

addi f, f, 1 表示 f = f + 1add f, g, h 表示 f = g + h

第二条指令将覆盖第一条指令中生成的 f 值,因此第一条指令没有实际效果(除了消耗时间和能量),除非符号 f 具有被定义为与gh相同的寄存器。

addi f, f, 1 means f = f + 1, and add f, g, h means f = 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 symbol f has been defined to be the same register as g or h.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文