开发者

How to move the value of a floating point register to a general-purpose register in MIPS?

I have the following bit of MIPS assembly, run on the MARS simulator, given below:

.data

x: .space 4 # 4 bytes = 32 bits

li $v0, 6
syscall

At this point, the floating point value I need is in $f0, but I need to move the value to x. If I could transfer the contents of the floating point register $f0 to $t0, I would be able to do this. Is this possible? If not, what is t开发者_如何学Che workaround?


You want the 'single precision store' pseudoinstruction. I think this one should stick whatever 32 bits are in $f0 to x.

s.s $f0, x

I just went and downloaded MARS and tested it out, it works fine here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜