Patchwork Basic support for MIPS r5900

login
register
mail settings
Submitter Jürgen Urban
Date June 23, 2013, 7:34 p.m.
Message ID <trinity-7e279729-5474-4a4d-9843-e21874df9bc1-1372016093550@3capp-gmx-bs16>
Download mbox | patch
Permalink /patch/253592/
State New
Headers show

Comments

Jürgen Urban - June 23, 2013, 7:34 p.m.
Hello Richard,

> >> Does it still work with those changes, as below?  If so, I'll check it in.
> >
> > I tested it. It is still working. So the patch is OK, please check it in.
>
> OK, I've applied this and the config.gcc patch.

Thanks.

In the native PS2SDK (i.e. no Linux) I detected that there are undefined references to `__fixtfsi', `__floatsitf', `__subtf3', `__multf3', `__extenddftf2', `__lttf2' and `__gttf2'. These are the functions for handling "long double".
There is a fix needed for this in libgcc. I attached 2 patches to this e-mail. There should be only one of the patches used to fix this.
The first one fixes the problem for all mips systems. The second one fixes this only for r5900. I think it is a general problem. I assume the undefined references could appear on all mips64 systems which are not Linux. So the first patch should be applied.
Checking for "ac_cv_sizeof_long_double" should work on all mips systems, but I don't know why the check was only in the mips*-linux part of the file libgcc/config.host.

Best regards
Jürgen
Richard Sandiford - June 23, 2013, 8:21 p.m.
"Jürgen Urban" <JuergenUrban@gmx.de> writes:
> Hello Richard,
>
>> >> Does it still work with those changes, as below?  If so, I'll check it in.
>> >
>> > I tested it. It is still working. So the patch is OK, please check it in.
>>
>> OK, I've applied this and the config.gcc patch.
>
> Thanks.
>
> In the native PS2SDK (i.e. no Linux) I detected that there are undefined
> references to `__fixtfsi', `__floatsitf', `__subtf3', `__multf3',
> __extenddftf2', `__lttf2' and `__gttf2'. These are the functions for
> handling "long double".
> There is a fix needed for this in libgcc. I attached 2 patches to this
> e-mail. There should be only one of the patches used to fix this.
> The first one fixes the problem for all mips systems. The second one
> fixes this only for r5900. I think it is a general problem. I assume the
> undefined references could appear on all mips64 systems which are not
> Linux. So the first patch should be applied.

The second patch is right.  Not all targets have 128-bit long doubles,
so t-tpbit is intentionally an opt-in rather than opt-out thing.

E.g. mips*-sde-elf and mips*-mti-elf both use:

#undef LONG_DOUBLE_TYPE_SIZE
#define LONG_DOUBLE_TYPE_SIZE 64

to get a form of n32 in which long doubles are the same as doubles.

Do you want to stick with 128-bit long doubles for PS2, or would you
prefer to do what SDE does?

Thanks,
Richard
Jürgen Urban - June 24, 2013, 8:07 a.m.
Hello Richard,

Am 23.06.2013 um 22:21 schrieb Richard Sandiford <rdsandiford@googlemail.com>:

> "Jürgen Urban" <JuergenUrban@gmx.de> writes:
>> 
>> In the native PS2SDK (i.e. no Linux) I detected that there are undefined
>> references to `__fixtfsi', `__floatsitf', `__subtf3', `__multf3',
>> __extenddftf2', `__lttf2' and `__gttf2'. These are the functions for
>> handling "long double".
>> There is a fix needed for this in libgcc. I attached 2 patches to this
>> e-mail. There should be only one of the patches used to fix this.
>> The first one fixes the problem for all mips systems. The second one
>> fixes this only for r5900. I think it is a general problem. I assume the
>> undefined references could appear on all mips64 systems which are not
>> Linux. So the first patch should be applied.
> 
> The second patch is right.  Not all targets have 128-bit long doubles,
> so t-tpbit is intentionally an opt-in rather than opt-out thing.
> 
> E.g. mips*-sde-elf and mips*-mti-elf both use:
> 
> #undef LONG_DOUBLE_TYPE_SIZE
> #define LONG_DOUBLE_TYPE_SIZE 64
> 
> to get a form of n32 in which long doubles are the same as doubles.
> 
> Do you want to stick with 128-bit long doubles for PS2, or would you
> prefer to do what SDE does?

I prefer shorter long doubles because of the performance impact. For 32 bit hard float we may need it. Can you change it or do I need to submit a patch?

Best regards
Jürgen

Patch

Index: libgcc/config.host
===================================================================
--- libgcc/config.host	(Revision 200155)
+++ libgcc/config.host	(Arbeitskopie)
@@ -798,6 +798,9 @@ 
 mips64r5900-*-elf* | mips64r5900el-*-elf*)
 	tmake_file="$tmake_file mips/t-elf mips/t-crtstuff"
 	extra_parts="$extra_parts crti.o crtn.o"
+	if test "${ac_cv_sizeof_long_double}" = 16; then
+		tmake_file="${tmake_file} mips/t-tpbit"
+	fi
 	;;
 mips64vr-*-elf* | mips64vrel-*-elf*)
 	tmake_file="$tmake_file mips/t-elf mips/t-vr mips/t-crtstuff"