* as is: mips-tdep long doubles...
@ 2013-01-01 14:03 Joel Brobecker
2013-01-01 14:37 ` Joel Brobecker
0 siblings, 1 reply; 4+ messages in thread
From: Joel Brobecker @ 2013-01-01 14:03 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 306 bytes --]
Hello,
Attached is a patch that might be interesting to people who are still
running GDB on mips-irix... As the FIXME suggests, it is not perfect,
but it helps. Since I will probably never find the time to improve it,
I thought I'd just publish the patch here, in case someone could use it
too.
--
Joel
[-- Attachment #2: mips-long-double.diff --]
[-- Type: text/x-diff, Size: 1560 bytes --]
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index c7684f8..89afeb8 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -187,6 +187,38 @@ static unsigned int mips_debug = 0;
struct target_desc *mips_tdesc_gp32;
struct target_desc *mips_tdesc_gp64;
+static int
+n32n64_floatformat_always_valid (const struct floatformat *fmt,
+ const void *from)
+{
+ return 1;
+}
+
+/* FIXME: brobecker/2004-08-08: Long Double values are 128 bit long.
+ They are implemented as a pair of 64bit doubles where the high
+ part holds the result of the operation rounded to double, and
+ the low double holds the difference between the exact result and
+ the rounded result. So "high" + "low" contains the result with
+ added precision. Unfortunately, the floatformat structure used
+ by GDB is not powerful enough to describe this format. As a temporary
+ measure, we define a 128bit floatformat that only uses the high part.
+ We lose a bit of precision but that's probably the best we can do
+ for now with the current infrastructure. */
+
+static const struct floatformat floatformat_n32n64_long_double_big =
+{
+ floatformat_big, 128, 0, 1, 11, 1023, 2047, 12, 52,
+ floatformat_intbit_no,
+ "floatformat_n32n64_long_double_big",
+ n32n64_floatformat_always_valid
+};
+
+static const struct floatformat *floatformats_n32n64_long[BFD_ENDIAN_UNKNOWN] =
+{
+ &floatformat_n32n64_long_double_big,
+ &floatformat_n32n64_long_double_big
+};
+
const struct mips_regnum *
mips_regnum (struct gdbarch *gdbarch)
{
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: as is: mips-tdep long doubles...
2013-01-01 14:03 as is: mips-tdep long doubles Joel Brobecker
@ 2013-01-01 14:37 ` Joel Brobecker
2013-01-04 18:29 ` Pedro Alves
0 siblings, 1 reply; 4+ messages in thread
From: Joel Brobecker @ 2013-01-01 14:37 UTC (permalink / raw)
To: gdb-patches
> Attached is a patch that might be interesting to people who are still
> running GDB on mips-irix... As the FIXME suggests, it is not perfect,
> but it helps. Since I will probably never find the time to improve it,
> I thought I'd just publish the patch here, in case someone could use it
> too.
Please ignore this. It was sent by my evil twin.
I think that the following patch takes care of everything (the diff
I sent wasn't even connecting the new definitions):
commit a14ee758af464230ab40c1a0d9adb4c7db34a9fc
Author: Joseph Myers <jsm@polyomino.org.uk>
Date: Thu Nov 8 00:08:48 2007 +0000
include:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.h (struct floatformat): Add split_half field.
(floatformat_ibm_long_double): New.
libiberty:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.c (mant_bits_set): New.
(floatformat_to_double): Use it. Note no special handling of
split formats.
(floatformat_from_double): Note no special handing of split
formats.
(floatformat_ibm_long_double_is_valid,
floatformat_ibm_long_double): New.
(floatformat_ieee_single_big, floatformat_ieee_single_little,
floatformat_ieee_double_big, floatformat_ieee_double_little,
floatformat_ieee_double_littlebyte_bigword, floatformat_vax_f,
floatformat_vax_d, floatformat_vax_g, floatformat_i387_ext,
floatformat_m68881_ext, floatformat_i960_ext,
floatformat_m88110_ext, floatformat_m88110_harris_ext,
floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword,
floatformat_ia64_spill_big, floatformat_ia64_spill_little,
floatformat_ia64_quad_big, floatformat_ia64_quad_little): Update
for addition of split_half field.
gdb:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* gdbtypes.c (floatformats_ibm_long_double): New.
* gdbtypes.h (floatformats_ibm_long_double): Declare.
* ia64-tdep.c (floatformat_ia64_ext): Update for addition of
split_half field.
* mips-tdep.c (n32n64_floatformat_always_valid,
floatformat_n32n64_long_double_big, floatformats_n32n64_long):
Remove.
(mips_gdbarch_init): Use floatformats_ibm_long_double instead of
floatformats_n32n64_long.
* ppc-linux-tdep.c (ppc_linux_init_abi): Use 128-bit IBM long
double.
* doublest.c (convert_floatformat_to_doublest,
convert_doublest_to_floatformat): Handle split floating-point
formats.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call): Handle IBM long
double arguments.
(ppc64_sysv_abi_push_dummy_call): Likewise.
(do_ppc_sysv_return_value): Handle IBM long double return.
--
Joel
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: as is: mips-tdep long doubles...
2013-01-01 14:37 ` Joel Brobecker
@ 2013-01-04 18:29 ` Pedro Alves
2013-01-04 19:24 ` Andreas Schwab
0 siblings, 1 reply; 4+ messages in thread
From: Pedro Alves @ 2013-01-04 18:29 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
On 01/01/2013 02:37 PM, Joel Brobecker wrote:
>> Attached is a patch that might be interesting to people who are still
>> running GDB on mips-irix... As the FIXME suggests, it is not perfect,
>> but it helps. Since I will probably never find the time to improve it,
>> I thought I'd just publish the patch here, in case someone could use it
>> too.
>
> Please ignore this. It was sent by my evil twin.
The good twin sent a ChangeLog entry only. :-)
>
> I think that the following patch takes care of everything (the diff
> I sent wasn't even connecting the new definitions):
>
> commit a14ee758af464230ab40c1a0d9adb4c7db34a9fc
> Author: Joseph Myers <jsm@polyomino.org.uk>
> Date: Thu Nov 8 00:08:48 2007 +0000
>
> include:
> 2007-11-07 Joseph Myers <joseph@codesourcery.com>
> Daniel Jacobowitz <dan@codesourcery.com>
>
> * floatformat.h (struct floatformat): Add split_half field.
> (floatformat_ibm_long_double): New.
>
> libiberty:
> 2007-11-07 Joseph Myers <joseph@codesourcery.com>
> Daniel Jacobowitz <dan@codesourcery.com>
>
> * floatformat.c (mant_bits_set): New.
> (floatformat_to_double): Use it. Note no special handling of
> split formats.
> (floatformat_from_double): Note no special handing of split
> formats.
> (floatformat_ibm_long_double_is_valid,
> floatformat_ibm_long_double): New.
> (floatformat_ieee_single_big, floatformat_ieee_single_little,
> floatformat_ieee_double_big, floatformat_ieee_double_little,
> floatformat_ieee_double_littlebyte_bigword, floatformat_vax_f,
> floatformat_vax_d, floatformat_vax_g, floatformat_i387_ext,
> floatformat_m68881_ext, floatformat_i960_ext,
> floatformat_m88110_ext, floatformat_m88110_harris_ext,
> floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword,
> floatformat_ia64_spill_big, floatformat_ia64_spill_little,
> floatformat_ia64_quad_big, floatformat_ia64_quad_little): Update
> for addition of split_half field.
>
> gdb:
> 2007-11-07 Joseph Myers <joseph@codesourcery.com>
> Daniel Jacobowitz <dan@codesourcery.com>
>
> * gdbtypes.c (floatformats_ibm_long_double): New.
> * gdbtypes.h (floatformats_ibm_long_double): Declare.
> * ia64-tdep.c (floatformat_ia64_ext): Update for addition of
> split_half field.
> * mips-tdep.c (n32n64_floatformat_always_valid,
> floatformat_n32n64_long_double_big, floatformats_n32n64_long):
> Remove.
> (mips_gdbarch_init): Use floatformats_ibm_long_double instead of
> floatformats_n32n64_long.
> * ppc-linux-tdep.c (ppc_linux_init_abi): Use 128-bit IBM long
> double.
> * doublest.c (convert_floatformat_to_doublest,
> convert_doublest_to_floatformat): Handle split floating-point
> formats.
> * ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call): Handle IBM long
> double arguments.
> (ppc64_sysv_abi_push_dummy_call): Likewise.
> (do_ppc_sysv_return_value): Handle IBM long double return.
>
>
>
--
Pedro Alves
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: as is: mips-tdep long doubles...
2013-01-04 18:29 ` Pedro Alves
@ 2013-01-04 19:24 ` Andreas Schwab
0 siblings, 0 replies; 4+ messages in thread
From: Andreas Schwab @ 2013-01-04 19:24 UTC (permalink / raw)
To: Pedro Alves; +Cc: Joel Brobecker, gdb-patches
Pedro Alves <palves@redhat.com> writes:
> On 01/01/2013 02:37 PM, Joel Brobecker wrote:
>>> Attached is a patch that might be interesting to people who are still
>>> running GDB on mips-irix... As the FIXME suggests, it is not perfect,
>>> but it helps. Since I will probably never find the time to improve it,
>>> I thought I'd just publish the patch here, in case someone could use it
>>> too.
>>
>> Please ignore this. It was sent by my evil twin.
>
> The good twin sent a ChangeLog entry only. :-)
You can find the patch here
<http://sourceware.org/ml/gdb-patches/2007-10/msg00743.html>.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-01-04 19:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-01 14:03 as is: mips-tdep long doubles Joel Brobecker
2013-01-01 14:37 ` Joel Brobecker
2013-01-04 18:29 ` Pedro Alves
2013-01-04 19:24 ` Andreas Schwab
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox