首页 > IT职业 > IT生活 > 计算机组成与设计 读书笔记——第三章
add.s add.d
c.x.s 双精度比较为c.x.d 其中x可能是eq neq lt le gt ge bclt 浮点比较为假跳转bclf
```c++
float f2c (float fahr) {
return ((5.0/9.0) * (fahr - 32.0));
}
```shell
# fahr在$f12中 结果放在$f0中
f2c:
lwcl $f16,const5($gp) # 把5.0存到$f16
lwcl $f18,const9($gp) # 把9.0存到$f18
div.s $f16,$f16,$f18 # 把5.0/9.0c存到$16
lwcl $f18,const32($gp) # 把32.0存到$f18
sub.s $f18,$f12,$f18 # $f18 = fahr - 32.0
mul.s $f0 ,$f16,$f18 # $f0 = (5/9)*(fahr - 32.0)
jr $ra # return 来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/430/viewspace-2807407/ ,如需转载,请注明出处,否则将追究法律责任。