"Jürgen Urban" <juergenur...@gmx.de> writes: > The problem happens with the r5900 hard float configurations, e.g.: > configure --target=mipsel-linux-gnu --with-float=hard --with-fpu=single > --with-arch=r5900 > I created the attached patch which fixes this problem for r5900 and > another problem explained later. > The fixed code generates the following code which should be correct > (mipsr5900el-ps2-elf): > > 00105440 <__extendsfdf2>: > 105440: 27bdffc8 addiu sp,sp,-56 > 105444: 27a40028 addiu a0,sp,40 > 105448: 27a50018 addiu a1,sp,24 > 10544c: afbf0034 sw ra,52(sp) > 105450: 0c0417b5 jal 105ed4 <__unpack_f> > 105454: e7ac0028 swc1 $f12,40(sp) > 105458: 8fa20024 lw v0,36(sp) > 10545c: 8fa40018 lw a0,24(sp) > 105460: 8fa5001c lw a1,28(sp) > 105464: 8fa60020 lw a2,32(sp) > 105468: 00021882 srl v1,v0,0x2 > 10546c: 00021780 sll v0,v0,0x1e > 105470: afa20010 sw v0,16(sp) > 105474: 0c041789 jal 105e24 <__make_dp> > 105478: afa30014 sw v1,20(sp) > 10547c: 8fbf0034 lw ra,52(sp) > 105480: 03e00008 jr ra > 105484: 27bd0038 addiu sp,sp,56 > > The default targets mipsr5900el and mips64r5900el are not affected by > the problem, because soft float is the default. > > It also seems that the same problem occurs with the following configuration: > configure --target=mipsel-linux-gnu --with-float=hard --with-fpu=single > I expected that this combination should work and a problem should > already be detected. Can somebody confirm that the problem also occurs > with default mipsel?
Although that configuration is in theory supported by GCC (said like that because I don't know the state of the glibc support for single-float), I don't think anyone uses it for any target other than r5900. But you're right that this is a --with-fpu=single thing rather than an r5900 thing, so I don't think the patch is correct. It should be keyed off whether the target is single-float or double-float, which you can test by checking whether the preprocessor macro __mips_single_float is defined. Note that this won't really be correct for r5900 anyway because of its non-IEEE FPU. E.g. the soft-float routines will treat 0x7f800000 as infinity and 0x7fffffff as a NaN, whereas for r5900 they should be treated as normal numbers. Thanks, Richard