From: Andrew Cagney <cagney@gnu.org>
To: gdb-patches@sources.redhat.com
Subject: Re: [patch/rfc] Add host's floatformat
Date: Thu, 29 Jul 2004 19:35:00 -0000 [thread overview]
Message-ID: <41095190.7020508@gnu.org> (raw)
In-Reply-To: <40939DD4.3000706@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 409 bytes --]
> Hello,
>
> This patch adds the host's floatformat (when known) to floatformat.[hc]. It lets us wack of a heap of bogus code in GDB's configury.
I've checked this in. Differences from the original:
- GDB handles this locally
- GDB_HOST_... instead of just HOST_... in names
- per MarkK's suggestion, the bulk of the logic is in configure.host
I'll follow up by pruning some now dead xm files.
Andrew
[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 6894 bytes --]
2004-07-29 Andrew Cagney <cagney@gnu.org>
* config/pa/xm-linux.h: Do not include "floatformat.h".
(HOST_FLOAT_FORMAT, HOST_DOUBLE_FORMAT)
(HOST_LONG_DOUBLE_FORMAT): Delete macros.
* config/i386/xm-i386.h: Do not include "floatformat.h".
(HOST_FLOAT_FORMAT, HOST_DOUBLE_FORMAT)
(HOST_LONG_DOUBLE_FORMAT): Delete macros.
* doublest.c (HOST_FLOAT_FORMAT, HOST_DOUBLE_FORMAT)
(HOST_LONG_DOUBLE_FORMAT): Delete macros. Use
GDB_HOST_FLOAT_FORMAT, GDB_HOST_DOUBLE_FORMAT and
GDB_HOST_LONG_DOUBLE_FORMAT instead.
* configure.in (GDB_HOST_FLOAT_FORMAT, GDB_HOST_DOUBLE_FORMAT)
(GDB_HOST_LONG_DOUBLE_FORMAT): Define.
* configure, config.in: Regenerate.
* configure.host (gdb_host_float_format, gdb_host_double_format)
(gdb_host_long_double_format): Set according to the host.
Index: config.in
===================================================================
RCS file: /cvs/src/src/gdb/config.in,v
retrieving revision 1.65
diff -p -u -r1.65 config.in
--- config.in 17 Jul 2004 11:24:26 -0000 1.65
+++ config.in 29 Jul 2004 18:44:06 -0000
@@ -540,6 +540,15 @@
/* Define if we can use the tkill syscall. */
#undef HAVE_TKILL_SYSCALL
+/* Host float floatformat */
+#undef GDB_HOST_FLOAT_FORMAT
+
+/* Host double floatformat */
+#undef GDB_HOST_DOUBLE_FORMAT
+
+/* Host long double floatformat */
+#undef GDB_HOST_LONG_DOUBLE_FORMAT
+
/* Define to the default OS ABI for this configuration. */
#undef GDB_OSABI_DEFAULT
Index: configure.host
===================================================================
RCS file: /cvs/src/src/gdb/configure.host,v
retrieving revision 1.80
diff -p -u -r1.80 configure.host
--- configure.host 26 Jun 2004 10:06:35 -0000 1.80
+++ configure.host 29 Jul 2004 18:44:06 -0000
@@ -2,8 +2,11 @@
# invoked from the autoconf generated configure script.
# This file sets the following shell variables:
-# gdb_host_cpu generic name of host's CPU
-# gdb_host name of GDB host definition to use
+# gdb_host_cpu generic name of host's CPU
+# gdb_host name of GDB host definition to use
+# gdb_host_float_format host's float floatformat, or 0
+# gdb_host_double_format host's double floatformat, or 0
+# gdb_host_long_double_format host's long double floatformat, or 0
# Map host cpu into the config cpu subdirectory name.
# The default is $host_cpu.
@@ -145,3 +148,26 @@ x86_64-*-openbsd*) gdb_host=obsd64 ;;
m32r*-*-linux*) gdb_host=linux ;;
esac
+
+
+
+# Map the host/cpu onto the floatformat correspondong to C's "float",
+# "double" and "long double" types.
+
+case "${host}" in
+i[34567]86-*-*)
+ gdb_host_float_format="&floatformat_ieee_single_little"
+ gdb_host_double_format="&floatformat_ieee_double_little"
+ gdb_host_long_double_format="&floatformat_i387_ext"
+ ;;
+hppa*-*-linux*)
+ gdb_host_float_format="&floatformat_ieee_single_big"
+ gdb_host_double_format="&floatformat_ieee_double_big"
+ gdb_host_long_double_format="&floatformat_ieee_double_big"
+ ;;
+*)
+ gdb_host_float_format=0
+ gdb_host_double_format=0
+ gdb_host_long_double_format=0
+ ;;
+esac
Index: configure.in
===================================================================
RCS file: /cvs/src/src/gdb/configure.in,v
retrieving revision 1.158
diff -p -u -r1.158 configure.in
--- configure.in 17 Jul 2004 11:24:24 -0000 1.158
+++ configure.in 29 Jul 2004 18:44:08 -0000
@@ -1300,6 +1300,11 @@ AC_SUBST(CONFIG_CLEAN)
AC_SUBST(CONFIG_INSTALL)
AC_SUBST(CONFIG_UNINSTALL)
+# List of host floatformats.
+AC_DEFINE_UNQUOTED(GDB_HOST_FLOAT_FORMAT,$gdb_host_float_format,[Host float floatformat])
+AC_DEFINE_UNQUOTED(GDB_HOST_DOUBLE_FORMAT,$gdb_host_double_format,[Host double floatformat])
+AC_DEFINE_UNQUOTED(GDB_HOST_LONG_DOUBLE_FORMAT,$gdb_host_long_double_format,[Host long double floatformat])
+
# target_subdir is used by the testsuite to find the target libraries.
target_subdir=
if test "${host}" != "${target}"; then
Index: doublest.c
===================================================================
RCS file: /cvs/src/src/gdb/doublest.c,v
retrieving revision 1.17
diff -p -u -r1.17 doublest.c
--- doublest.c 15 Sep 2003 21:33:44 -0000 1.17
+++ doublest.c 29 Jul 2004 18:44:08 -0000
@@ -91,10 +91,17 @@ get_field (unsigned char *data, enum flo
{
result |= (unsigned long)*(data + cur_byte) << cur_bitshift;
cur_bitshift += FLOATFORMAT_CHAR_BIT;
- if (order == floatformat_little || order == floatformat_littlebyte_bigword)
- ++cur_byte;
- else
- --cur_byte;
+ switch (order)
+ {
+ case floatformat_little:
+ ++cur_byte;
+ break;
+ case floatformat_big:
+ --cur_byte;
+ break;
+ case floatformat_littlebyte_bigword:
+ break;
+ }
}
if (len < sizeof(result) * FLOATFORMAT_CHAR_BIT)
/* Mask out bits which are not part of the field */
@@ -554,19 +561,9 @@ floatformat_mantissa (const struct float
increase precision as necessary. Otherwise, we call the conversion
routine and let it do the dirty work. */
-#ifndef HOST_FLOAT_FORMAT
-#define HOST_FLOAT_FORMAT 0
-#endif
-#ifndef HOST_DOUBLE_FORMAT
-#define HOST_DOUBLE_FORMAT 0
-#endif
-#ifndef HOST_LONG_DOUBLE_FORMAT
-#define HOST_LONG_DOUBLE_FORMAT 0
-#endif
-
-static const struct floatformat *host_float_format = HOST_FLOAT_FORMAT;
-static const struct floatformat *host_double_format = HOST_DOUBLE_FORMAT;
-static const struct floatformat *host_long_double_format = HOST_LONG_DOUBLE_FORMAT;
+static const struct floatformat *host_float_format = GDB_HOST_FLOAT_FORMAT;
+static const struct floatformat *host_double_format = GDB_HOST_DOUBLE_FORMAT;
+static const struct floatformat *host_long_double_format = GDB_HOST_LONG_DOUBLE_FORMAT;
void
floatformat_to_doublest (const struct floatformat *fmt,
Index: config/i386/xm-i386.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/xm-i386.h,v
retrieving revision 1.3
diff -p -u -r1.3 xm-i386.h
--- config/i386/xm-i386.h 22 Feb 2004 16:20:22 -0000 1.3
+++ config/i386/xm-i386.h 29 Jul 2004 18:44:08 -0000
@@ -22,10 +22,4 @@
#ifndef XM_I386_H
#define XM_I386_H
-#include "floatformat.h"
-
-#define HOST_FLOAT_FORMAT &floatformat_ieee_single_little
-#define HOST_DOUBLE_FORMAT &floatformat_ieee_double_little
-#define HOST_LONG_DOUBLE_FORMAT &floatformat_i387_ext
-
#endif /* xm-i386.h */
Index: config/pa/xm-linux.h
===================================================================
RCS file: /cvs/src/src/gdb/config/pa/xm-linux.h,v
retrieving revision 1.1
diff -p -u -r1.1 xm-linux.h
--- config/pa/xm-linux.h 29 Apr 2004 03:36:50 -0000 1.1
+++ config/pa/xm-linux.h 29 Jul 2004 18:44:08 -0000
@@ -22,10 +22,4 @@
#ifndef XM_HPPA_LINUX_H
#define XM_HPPA_LINUX_H
-#include "floatformat.h"
-
-#define HOST_FLOAT_FORMAT &floatformat_ieee_single_big
-#define HOST_DOUBLE_FORMAT &floatformat_ieee_double_big
-#define HOST_LONG_DOUBLE_FORMAT &floatformat_ieee_double_big
-
#endif /* xm-linux.h */
next prev parent reply other threads:[~2004-07-29 19:35 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-01 12:53 Andrew Cagney
2004-05-01 13:25 ` DJ Delorie
2004-05-01 14:28 ` Andrew Cagney
2004-05-01 14:06 ` Andreas Schwab
2004-05-01 14:34 ` Mark Kettenis
2004-05-01 15:00 ` Andrew Cagney
2004-05-01 17:20 ` Andrew Cagney
2004-05-02 10:04 ` Mark Kettenis
2004-05-02 20:49 ` DJ Delorie
2004-05-03 19:11 ` Andrew Cagney
2004-05-03 22:11 ` DJ Delorie
2004-05-03 22:29 ` Zack Weinberg
2004-05-03 22:34 ` DJ Delorie
2004-07-26 21:12 ` Andrew Cagney
2004-05-03 22:37 ` Andrew Cagney
2004-05-03 22:44 ` DJ Delorie
2004-05-03 23:21 ` Andrew Cagney
2004-05-03 23:48 ` DJ Delorie
2004-05-03 23:58 ` Zack Weinberg
2004-05-04 14:11 ` Andrew Cagney
2004-05-05 16:32 ` Andrew Cagney
2004-05-05 17:05 ` DJ Delorie
2004-05-02 20:49 ` DJ Delorie
2004-07-29 19:35 ` Andrew Cagney [this message]
2004-07-30 9:46 ` Andreas Schwab
2004-07-30 13:26 ` Andrew Cagney
2004-11-20 18:17 ` Andreas Schwab
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=41095190.7020508@gnu.org \
--to=cagney@gnu.org \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox