assembly - MIPS float : swc1 vs. s.s

标签 assembly floating-point mips

我正在做一些涉及 MIPS 的工作汇编,我不断遇到这四个浮点加载/存储伪指令:l.s , l.d , s.s , s.d .我在网上找到了一些文档,发现有四个“实际”指令似乎在做同样的事情:lwc1 , ldc1 , swc1 , 和 sdc1 .

我唯一的问题是,有什么区别?据我所知,这两组指令做的事情完全一样。是否存在伪代码只是因为它们更容易阅读?

提前感谢您的任何见解。

最佳答案

My only question is, what's the difference? As far as I can tell, both sets of instructions do exactly the same thing.



你是对的。唯一可能出现的区别是当一个伪指令被翻译成多个“真实”指令时。

Do the pseudos maybe exist just because they're easier to read?



再次,是的。那是 为什么他们存在。它们给人一种更具表现力的指令集的错觉。报价Computer organization and design / Patterson & Hennessy :

... the assembler can also treat common variations of machine language instructions as if they were instructions in their own right. The hardware need not implement these instructions; however, their appearance in aassembly language simplifies translation and programming. ...



鉴于您的示例,更“清楚”地说:
l.s $f2, 24(t1)       # Load Single contained in 24(t1) to $f2


lwc1 $f2, 24(t1)      # Load Word into Coprocessor 1 from 24(t1) to $f2

以及你可以更好地理解:
move $7, $18        # move contents of $18 to $7


add $7, $18, $0

对我来说,只有借助助记符才能获得更清晰易读的代码。

关于assembly - MIPS float : swc1 vs. s.s,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1165807/

相关文章:

assembly - AVX2 中的 VPERMB 在哪里?

c - 如何在 C 中将 float 转换为字符串而不丢失用户输入的精度?

assembly - 如何将 $t5 存储到 $t7 中

将C程序转换为MIPS汇编语言程序

performance - 涉及英特尔SnB系列CPU上涉及微编码指令的循环的分支对齐

c++ - 在什么情况下我想在 C/C++ 代码中使用内联汇编代码

assembly - 如何从汇编中的地址加载单个字节

c# - System.Decimal 是否一致?

c++ - ldexp 应该正确舍入

assembly - 为什么我不能在 MARS 中使用 li.s?