assembly - 在MIPS中,有符号加法、无符号加法、有符号减法和无符号减法有什么区别?

标签 assembly mips

add rd, rs, rt
addu rd, rs, rt
sub rd, rs, rt
subu rd, rs, rt

在MIPS中,有符号加法、无符号加法、有符号减法和无符号减法有什么区别?如果它们的结果相同,那么归类为使用有符号和无符号方法有什么意义?

最佳答案

u只是意味着他们不会因溢出而陷入困境。

引自“MIPS32 Architecture For Programmers Volume II”:

The term "unsigned" in the instruction name is a misnomer; this operation is 32-bit modulo arithmetic that does not trap on overflow. This instruction is appropriate for unsigned arithmetic, such as address arithmetic, or integer arithmetic environments that ignore overflow, such as C language arithmetic.

关于assembly - 在MIPS中,有符号加法、无符号加法、有符号减法和无符号减法有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19544539/

相关文章:

C 到 Mips 转换嵌套函数哪些寄存器保存在堆栈上?

assembly - assembly 流水线

c - 为什么visual studio能识别__asm{}却不能识别汇编代码?

assembly - 磁盘读取功能在引导加载程序中未按预期工作

assembly - QEMU 是否使用与 x86 到 x86 仿真的 guest 寄存器相同的主机寄存器?

assembly - MIPS:将两个 32 位数字相乘,得到 64 位数字

linux - 如何为busybox中的每个小程序构建ELF文件?

c - 为什么编译器要在栈上腾出空间

assembly - 试图理解汇编指令 : cltd on x86

linux - 加载共享库时出错 : unexpected reloc type 0x7e