[Mono-dev] Mono:MIPS patch

Yoichi NAKAYAMA nakayama at pixela.co.jp
Fri Oct 19 04:11:05 EDT 2007


At Thu, 18 Oct 2007 09:41:51 +0900,
Yoichi NAKAYAMA wrote:
> With those changes, I've checked that "mono --regression basic-long.exe"
> passes except test_0_conv_to_r4 (tested on Debian-MIPS on qemu).

Then I've investigated test_0_conv_to_r4 failure.
Dump of __emul_lconv_to_r4 generated by "mono -v -v" is:

  00000000 <System_Object___icall_wrapper___emul_lconv_to_r4>:
    e8:   8fc20154        lw      v0,340(s8)
    ec:   8fc30150        lw      v1,336(s8)
    f0:   00602020        add     a0,v1,zero
    f4:   00402820        add     a1,v0,zero
    f8:   3c190056        lui     t9,0x56
    fc:   27392f44        addiu   t9,t9,12100
   100:   0320f809        jalr    t9              # 0x562F44 == mono_lconv_to_r4
   104:   00000000        nop
   108:   462004a0        cvt.s.d $f18,$f0
   10c:   e7d20020        swc1    $f18,32(s8)
   110:   c7c00020        lwc1    $f0,32(s8)
   114:   46000021        cvt.d.s $f0,$f0
   118:   f7c00028        sdc1    $f0,40(s8)

At 108, it assumes return value of mono_lconv_to_r4 is stored
on f0 as double precision float. Although, it is stored as single
precision float, then wrong value seems to be returned.

% objdump -r -d jit-icalls.o 
  00000234 <mono_lconv_to_r4>:
       234:       3c1c0000        lui     gp,0x0
                          234: R_MIPS_HI16        _gp_disp
       238:       279c0000        addiu   gp,gp,0
                          238: R_MIPS_LO16        _gp_disp
       23c:       0399e021        addu    gp,gp,t9
       240:       27bdffe0        addiu   sp,sp,-32
       244:       afbf0018        sw      ra,24(sp)
       248:       afbc0010        sw      gp,16(sp)
       24c:       8f990000        lw      t9,0(gp)
                          24c: R_MIPS_CALL16      __floatdisf
       250:       00000000        nop
       254:       0320f809        jalr    t9
       258:       00000000        nop
       25c:       8fbc0010        lw      gp,16(sp)
       260:       8fbf0018        lw      ra,24(sp)
       264:       00000000        nop
       268:       03e00008        jr      ra
       26c:       27bd0020        addiu   sp,sp,32

I've changed mono_lconv_to_r4's return type to double,
and confirmed that mono passes test_0_conv_to_r4 on MIPS.

Is it a correct fix? I wonder why this was not a problem on
other platforms (arm, hppa, ppc, s390 and sparc where

Pixela Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mono_lconv_to_r4.patch
Type: application/octet-stream
Size: 1429 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20071019/69ac4c81/attachment.obj 

More information about the Mono-devel-list mailing list