From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27268 invoked by alias); 29 Jul 2004 19:35:51 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 27260 invoked from network); 29 Jul 2004 19:35:51 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org with SMTP; 29 Jul 2004 19:35:51 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.10/8.12.10) with ESMTP id i6TJZoe3020957 for ; Thu, 29 Jul 2004 15:35:50 -0400 Received: from localhost.redhat.com (porkchop.devel.redhat.com [172.16.58.2]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id i6TJZna19164; Thu, 29 Jul 2004 15:35:49 -0400 Received: from gnu.org (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id DC6152B9D; Thu, 29 Jul 2004 15:35:44 -0400 (EDT) Message-ID: <41095190.7020508@gnu.org> Date: Thu, 29 Jul 2004 19:35:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-GB; rv:1.4.1) Gecko/20040217 MIME-Version: 1.0 To: gdb-patches@sources.redhat.com Subject: Re: [patch/rfc] Add host's floatformat References: <40939DD4.3000706@gnu.org> In-Reply-To: <40939DD4.3000706@gnu.org> Content-Type: multipart/mixed; boundary="------------010207000102010403080300" X-SW-Source: 2004-07/txt/msg00448.txt.bz2 This is a multi-part message in MIME format. --------------010207000102010403080300 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-length: 409 > 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 --------------010207000102010403080300 Content-Type: text/plain; name="diffs" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="diffs" Content-length: 6894 2004-07-29 Andrew Cagney * 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 */ --------------010207000102010403080300--