MIPS (or SPIM): Loading floating point numbers

前端 未结 2 638
醉话见心
醉话见心 2020-12-19 07:57

I am working on a little mini compiler while trying to learn some MIPS here. Here\'s my issue:

MIPS has an instruction li (load immediate) which would work like thi

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-19 08:38

    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
    

提交回复
热议问题