MIPS浮点数:swc1与s.s [英] MIPS floating-point: swc1 vs. s.s

查看:456
本文介绍了MIPS浮点数:swc1与s.s的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一些涉及MIPS组装的工作,并且不断遇到以下四个浮点加载/存储伪指令:l.sl.ds.ss.d.我在网上找到了一些文档,发现有四个实际"指令似乎在做同样的事情:lwc1ldc1swc1sdc1.

I'm doing some work involving MIPS assembly, and I keep coming across these four floating-point load/store pseudoinstructions: l.s, l.d, s.s, s.d. I found some documentation online and figured out that there are four "actual" instructions that seem to do the same thing: lwc1, ldc1, swc1, and 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?

在此先感谢您的见解.

推荐答案

我唯一的问题是,有什么区别?据我所知,这两组指令的作用完全相同.

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

是的,您是对的.可能出现的唯一区别是将伪指令转换为多个真实"指令时.

Yes, you're right. The only difference that could appear is when a pseudo-instruction is translated to more than one "real" instruction.

伪造者是否可能仅仅因为它们更易于阅读而存在?

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

再次,是的.这就是它们为什么存在的原因.他们给人以更富表现力的指令集的错觉.引用

Again, yes. That's why they exist. They give the illusion of a more expressive instruction set. Quoting 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. ...

以您的示例为例,更清晰"地说:

Given your example, it's more "clear" to say:

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

以及您可以更好地理解的地方:

as well as you can understand better:

move $7, $18        # move contents of $18 to $7

add $7, $18, $0

对我来说,助记符可以帮助它获得更好的易读代码.

For me, it's just be helped by mnemonics to get better legible code.

这篇关于MIPS浮点数:swc1与s.s的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆