MIPS (or SPIM): Loading floating point numbers

♀尐吖头ヾ 提交于 2019-11-29 10:51:47

You will need to use the floating point registers to load your floats.

Instead of:

li $5,2.5

Try:

li.s $f5,2.5

Take a look at mfc1 and mtc1 instructions to move between integer and floating point registers.

Zack

MARS does not appear to have any instructions/pseudo instructions that load floating point immediate values into floating registers. Instead, you need to put the floating point value in memory and load the register from memory:

.data
fp1: .double 2.5
fp2: .double -0.75

.text   
l.d $f0, fp1
l.d $f2, fp2
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!