From 9a79452d4cad6c34e9ff7c4370157bb1d6ad8869 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Tue, 23 Sep 2014 01:48:46 +0100 Subject: [PATCH] Remove LIBGCC2_LONG_DOUBLE_TYPE_SIZE target macro. This patch removes the target macro LIBGCC2_LONG_DOUBLE_TYPE_SIZE. After recent changes, this macro was used in two ways in libgcc: to determine the mode of long double in dfp-bit.h, and to determine whether a particular mode has excess precision for use in complex multiplication. The former is concerned specifically with long double: it relates to use of strtold for converting between decimal and binary floating point. This is replaced by comparing __LDBL_MANT_DIG__ with the appropriate __LIBGCC_*_MANT_DIG__ macro. The latter is replaced __LIBGCC_*_EXCESS_PRECISION__ predefined macros. Remarks: * Comparing (__LDBL_MANT_DIG__ == __LIBGCC_XF_MANT_DIG__) is more fragile than it looks; it's possible for XFmode to have 53-bit mantissa (TARGET_96_ROUND_53_LONG_DOUBLE, on FreeBSD and DragonFlyBSD 32-bit), in which case such a comparison would not distinguish XFmode and DFmode as possible modes for long double. Fortunately, no target supporting that form of XFmode also supports long double = double (but if some target did, we'd need e.g. an additional macro giving the exponent range of each mode). Furthermore, this code doesn't actually get used for x86 (or any other target with XFmode support), because x86 uses BID not DPD and BID has its own conversion code (which handles conversions for both XFmode and TFmode without needing to go via strtold). And FreeBSD and DragonFlyBSD aren't among the targets with DFP support. So while in principle this code is fragile and it's a deficiency that it can't support both XFmode and TFmode at once (something that can't be solved with the string conversion approach without libc having TS 18661 functions such as strtof128), all these issues should not be a problem in practice. * If other cases of excess precision are supported in future, the code for defining __LIBGCC_*_EXCESS_PRECISION__ may need updating. Although the most likely such cases might not actually involve excess precision for any mode used in libgcc - FLT_EVAL_METHOD being 32 to do _Float16 arithmetic on _Float32 should have the effect of _Complex _Float16 arithmetic using __mulsc3 and __divsc3, rather than currently nonexistent __mulhc3 and __divhc3 as in bug 63250 for ARM. * As has been noted in the context of simultaneous support for __float128 and __ibm128 on Power, the semantics of macros such as LONG_DOUBLE_TYPE_SIZE are problematic because they rely on a poorly-defined precision value for floating-point modes (which seems to be intended as the number of significant bits in the representation, e.g. 80 for XFmode which may be either 12 or 16 bytes) uniquely identifying a mode (although defining an arbitrarily different value for one of the modes you wish to distinguish may work as a hack). It would be cleaner to have a target hook that gives a machine mode directly for float, double and long double, rather than going via these precision values. By eliminating all use of these macros (FLOAT_TYPE_SIZE, DOUBLE_TYPE_SIZE, LONG_DOUBLE_TYPE_SIZE) from code built for the target, this patch facilitates such a conversion to a hook (which I suppose would take some suitable enum as an argument to identify which of the three types to return a mode for). (The issue of multiple type support for DFP conversions would apply in that Power case. doesn't seem to touch on it, but it would seem reasonable to punt on it initially as hard to fix. There would also be the issue of getting functions such as __powikf2, __mulkc3, __divkc3 defined, but that's rather easier to address.) Bootstrapped with no regressions on x86_64-unknown-linux-gnu. gcc: * doc/tm.texi.in (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Remove. * doc/tm.texi: Regenerate. * system.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Poison. * config/alpha/alpha.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Remove. * config/i386/i386-interix.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Remove. * config/i386/i386.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Remove. * config/i386/rtemself.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Remove. * config/ia64/ia64.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Remove. * config/m68k/m68k.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Remove. * config/m68k/netbsd-elf.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Remove. * config/mips/mips.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Remove. * config/mips/n32-elf.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Remove. * config/msp430/msp430.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Remove. * config/rl78/rl78.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Remove. * config/rs6000/rs6000.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Remove. * config/rx/rx.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Remove. * config/s390/s390.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Remove. * config/sparc/freebsd.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Remove. * config/sparc/linux.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Remove. * config/sparc/linux64.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Remove. * config/sparc/netbsd-elf.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Remove. gcc/c-family: * c-cppbuiltin.c (c_cpp_builtins): Define __LIBGCC_*_EXCESS_PRECISION__ macros for supported floating-point modes. libgcc: * dfp-bit.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Remove. (__LIBGCC_XF_MANT_DIG__): Define if not already defined. (LONG_DOUBLE_HAS_XF_MODE): Define in terms of __LIBGCC_XF_MANT_DIG__. (__LIBGCC_TF_MANT_DIG__): Define if not already defined. (LONG_DOUBLE_HAS_TF_MODE): Define in terms of __LIBGCC_TF_MANT_DIG__. * libgcc2.c (NOTRUNC): Define in terms of __LIBGCC_*_EXCESS_PRECISION__, not LIBGCC2_LONG_DOUBLE_TYPE_SIZE. * libgcc2.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Remove. From-SVN: r215491 --- gcc/ChangeLog | 27 +++++++++++++++++++++++++++ gcc/c-family/ChangeLog | 6 ++++++ gcc/c-family/c-cppbuiltin.c | 24 ++++++++++++++++++++++++ gcc/config/alpha/alpha.h | 8 -------- gcc/config/i386/i386-interix.h | 2 -- gcc/config/i386/i386.h | 10 ---------- gcc/config/i386/rtemself.h | 7 ------- gcc/config/ia64/ia64.h | 4 ---- gcc/config/m68k/m68k.h | 8 -------- gcc/config/m68k/netbsd-elf.h | 7 ------- gcc/config/mips/mips.h | 9 --------- gcc/config/mips/n32-elf.h | 5 ----- gcc/config/msp430/msp430.h | 2 -- gcc/config/rl78/rl78.h | 2 -- gcc/config/rs6000/rs6000.h | 8 -------- gcc/config/rx/rx.h | 6 ------ gcc/config/s390/s390.h | 8 -------- gcc/config/sparc/freebsd.h | 8 -------- gcc/config/sparc/linux.h | 8 -------- gcc/config/sparc/linux64.h | 8 -------- gcc/config/sparc/netbsd-elf.h | 12 ------------ gcc/doc/tm.texi | 7 ------- gcc/doc/tm.texi.in | 7 ------- gcc/system.h | 3 ++- libgcc/ChangeLog | 13 +++++++++++++ libgcc/dfp-bit.h | 14 ++++++++------ libgcc/libgcc2.c | 12 ++++-------- libgcc/libgcc2.h | 4 ---- 28 files changed, 84 insertions(+), 155 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 96a5d7a66e4..f91e231f2e6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,30 @@ +2014-09-22 Joseph Myers + + * doc/tm.texi.in (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Remove. + * doc/tm.texi: Regenerate. + * system.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Poison. + * config/alpha/alpha.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Remove. + * config/i386/i386-interix.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): + Remove. + * config/i386/i386.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Remove. + * config/i386/rtemself.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Remove. + * config/ia64/ia64.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Remove. + * config/m68k/m68k.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Remove. + * config/m68k/netbsd-elf.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): + Remove. + * config/mips/mips.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Remove. + * config/mips/n32-elf.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Remove. + * config/msp430/msp430.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Remove. + * config/rl78/rl78.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Remove. + * config/rs6000/rs6000.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Remove. + * config/rx/rx.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Remove. + * config/s390/s390.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Remove. + * config/sparc/freebsd.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Remove. + * config/sparc/linux.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Remove. + * config/sparc/linux64.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Remove. + * config/sparc/netbsd-elf.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): + Remove. + 2014-09-22 Jan Hubicka * tree-ssa-ccp.c (prop_value_d): Rename to ... diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index efe74173f17..468c78bfa26 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,9 @@ +2014-09-22 Joseph Myers + + * c-cppbuiltin.c (c_cpp_builtins): Define + __LIBGCC_*_EXCESS_PRECISION__ macros for supported floating-point + modes. + 2014-09-18 Joseph Myers * c-cppbuiltin.c (c_cpp_builtins): Define __LIBGCC_*_FUNC_EXT__ diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c index 9e2040b67d5..6748db435ed 100644 --- a/gcc/c-family/c-cppbuiltin.c +++ b/gcc/c-family/c-cppbuiltin.c @@ -978,6 +978,30 @@ c_cpp_builtins (cpp_reader *pfile) else gcc_unreachable (); builtin_define_with_value (macro_name, suffix, 0); + bool excess_precision = false; + if (TARGET_FLT_EVAL_METHOD != 0 + && mode != TYPE_MODE (long_double_type_node) + && (mode == TYPE_MODE (float_type_node) + || mode == TYPE_MODE (double_type_node))) + switch (TARGET_FLT_EVAL_METHOD) + { + case -1: + case 2: + excess_precision = true; + break; + + case 1: + excess_precision = mode == TYPE_MODE (float_type_node); + break; + + default: + gcc_unreachable (); + } + macro_name = (char *) alloca (strlen (name) + + sizeof ("__LIBGCC__EXCESS_" + "PRECISION__")); + sprintf (macro_name, "__LIBGCC_%s_EXCESS_PRECISION__", name); + builtin_define_with_int_value (macro_name, excess_precision); } /* For libgcc crtstuff.c and libgcc2.c. */ diff --git a/gcc/config/alpha/alpha.h b/gcc/config/alpha/alpha.h index 88816f3148c..ea5fd13af19 100644 --- a/gcc/config/alpha/alpha.h +++ b/gcc/config/alpha/alpha.h @@ -203,14 +203,6 @@ extern enum alpha_fp_trap_mode alpha_fptm; #define DOUBLE_TYPE_SIZE 64 #define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64) -/* Define this to set long double type size to use in libgcc2.c, which can - not depend on target_flags. */ -#ifdef __LONG_DOUBLE_128__ -#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128 -#else -#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64 -#endif - /* Work around target_flags dependency in ada/targtyps.c. */ #define WIDEST_HARDWARE_FP_SIZE 64 diff --git a/gcc/config/i386/i386-interix.h b/gcc/config/i386/i386-interix.h index 49aef842f76..98b8ae14660 100644 --- a/gcc/config/i386/i386-interix.h +++ b/gcc/config/i386/i386-interix.h @@ -140,8 +140,6 @@ do { \ /* Turn off long double being 96 bits. */ #undef LONG_DOUBLE_TYPE_SIZE #define LONG_DOUBLE_TYPE_SIZE 64 -#undef LIBGCC2_LONG_DOUBLE_TYPE_SIZE -#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64 #define IX86_NO_LIBGCC_TFMODE diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 2c641628d74..63005460783 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -694,16 +694,6 @@ extern const char *host_detect_local_cpu (int argc, const char **argv); #define LONG_DOUBLE_TYPE_SIZE \ (TARGET_LONG_DOUBLE_64 ? 64 : (TARGET_LONG_DOUBLE_128 ? 128 : 80)) -/* Define this to set long double type size to use in libgcc2.c, which can - not depend on target_flags. */ -#ifdef __LONG_DOUBLE_64__ -#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64 -#elif defined (__LONG_DOUBLE_128__) -#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128 -#else -#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 80 -#endif - #define WIDEST_HARDWARE_FP_SIZE 80 #if defined (TARGET_BI_ARCH) || TARGET_64BIT_DEFAULT diff --git a/gcc/config/i386/rtemself.h b/gcc/config/i386/rtemself.h index ce6d762948d..1461a9e9c4d 100644 --- a/gcc/config/i386/rtemself.h +++ b/gcc/config/i386/rtemself.h @@ -32,11 +32,4 @@ along with GCC; see the file COPYING3. If not see #undef LONG_DOUBLE_TYPE_SIZE #define LONG_DOUBLE_TYPE_SIZE (TARGET_80387 ? 80 : 64) -#undef LIBGCC2_LONG_DOUBLE_TYPE_SIZE -#ifdef _SOFT_FLOAT -#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64 -#else -#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 80 -#endif - #define IX86_NO_LIBGCC_TFMODE diff --git a/gcc/config/ia64/ia64.h b/gcc/config/ia64/ia64.h index 4cc80a9c8ea..372bee740a7 100644 --- a/gcc/config/ia64/ia64.h +++ b/gcc/config/ia64/ia64.h @@ -253,10 +253,6 @@ while (0) : TARGET_ABI_OPEN_VMS ? 64 \ : 80) -/* We always want the XFmode operations from libgcc2.c, except on VMS - where this yields references to unimplemented "insns". */ -#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE (TARGET_ABI_OPEN_VMS ? 64 : 80) - #define DEFAULT_SIGNED_CHAR 1 diff --git a/gcc/config/m68k/m68k.h b/gcc/config/m68k/m68k.h index 5a6ceb50300..a621b627a39 100644 --- a/gcc/config/m68k/m68k.h +++ b/gcc/config/m68k/m68k.h @@ -280,14 +280,6 @@ along with GCC; see the file COPYING3. If not see #define LONG_DOUBLE_TYPE_SIZE \ ((TARGET_COLDFIRE || TARGET_FIDOA) ? 64 : 80) -/* We need to know the size of long double at compile-time in libgcc2. */ - -#if defined(__mcoldfire__) || defined(__mfido__) -#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64 -#else -#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 80 -#endif - /* Set the value of FLT_EVAL_METHOD in float.h. When using 68040 fp instructions, we get proper intermediate rounding, otherwise we get extended precision results. */ diff --git a/gcc/config/m68k/netbsd-elf.h b/gcc/config/m68k/netbsd-elf.h index be891933841..eade5b41921 100644 --- a/gcc/config/m68k/netbsd-elf.h +++ b/gcc/config/m68k/netbsd-elf.h @@ -39,13 +39,6 @@ along with GCC; see the file COPYING3. If not see #undef LONG_DOUBLE_TYPE_SIZE #define LONG_DOUBLE_TYPE_SIZE (TARGET_68020 ? 80 : 64) -#undef LIBGCC2_LONG_DOUBLE_TYPE_SIZE -#ifdef __mc68010__ -#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64 -#else -#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 80 -#endif - #undef SUBTARGET_EXTRA_SPECS #define SUBTARGET_EXTRA_SPECS \ { "netbsd_entry_point", NETBSD_ENTRY_POINT }, diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index 9a15287cdb1..c7b998bf758 100644 --- a/gcc/config/mips/mips.h +++ b/gcc/config/mips/mips.h @@ -1399,15 +1399,6 @@ struct mips_cpu_info { support long double, we also want a 128-bit integer type. */ #define MAX_FIXED_MODE_SIZE LONG_DOUBLE_TYPE_SIZE -#ifdef IN_LIBGCC2 -#if ((defined _ABIN32 && _MIPS_SIM == _ABIN32) \ - || (defined _ABI64 && _MIPS_SIM == _ABI64)) -# define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128 -# else -# define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64 -# endif -#endif - /* Width in bits of a pointer. */ #ifndef POINTER_SIZE #define POINTER_SIZE ((TARGET_LONG64 && TARGET_64BIT) ? 64 : 32) diff --git a/gcc/config/mips/n32-elf.h b/gcc/config/mips/n32-elf.h index cb0cbbf9560..a611a9e404a 100644 --- a/gcc/config/mips/n32-elf.h +++ b/gcc/config/mips/n32-elf.h @@ -28,8 +28,3 @@ along with GCC; see the file COPYING3. If not see /* Force n32 to use 64-bit long doubles. */ #undef LONG_DOUBLE_TYPE_SIZE #define LONG_DOUBLE_TYPE_SIZE 64 - -#ifdef IN_LIBGCC2 -#undef LIBGCC2_LONG_DOUBLE_TYPE_SIZE -#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64 -#endif diff --git a/gcc/config/msp430/msp430.h b/gcc/config/msp430/msp430.h index 068bdada814..70196e2e7d9 100644 --- a/gcc/config/msp430/msp430.h +++ b/gcc/config/msp430/msp430.h @@ -111,8 +111,6 @@ extern bool msp430x; #define DOUBLE_TYPE_SIZE 64 #define LONG_DOUBLE_TYPE_SIZE 64 /*DOUBLE_TYPE_SIZE*/ -#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64 - #define DEFAULT_SIGNED_CHAR 0 #define STRICT_ALIGNMENT 1 diff --git a/gcc/config/rl78/rl78.h b/gcc/config/rl78/rl78.h index 947c4084661..c3cae69275a 100644 --- a/gcc/config/rl78/rl78.h +++ b/gcc/config/rl78/rl78.h @@ -98,8 +98,6 @@ #define DOUBLE_TYPE_SIZE 32 /*64*/ #define LONG_DOUBLE_TYPE_SIZE 64 /*DOUBLE_TYPE_SIZE*/ -#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64 - #define DEFAULT_SIGNED_CHAR 0 #define STRICT_ALIGNMENT 1 diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index 8a0fcab63f8..1fd4f2aa021 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -820,14 +820,6 @@ extern unsigned char rs6000_recip_bits[]; words. */ #define LONG_DOUBLE_TYPE_SIZE rs6000_long_double_type_size -/* Define this to set long double type size to use in libgcc2.c, which can - not depend on target_flags. */ -#ifdef __LONG_DOUBLE_128__ -#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128 -#else -#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64 -#endif - /* Work around rs6000_long_double_type_size dependency in ada/targtyps.c. */ #define WIDEST_HARDWARE_FP_SIZE 64 diff --git a/gcc/config/rx/rx.h b/gcc/config/rx/rx.h index 2a008f7aa53..57a24e6dd20 100644 --- a/gcc/config/rx/rx.h +++ b/gcc/config/rx/rx.h @@ -130,12 +130,6 @@ #define DOUBLE_TYPE_SIZE (TARGET_64BIT_DOUBLES ? 64 : 32) #define LONG_DOUBLE_TYPE_SIZE DOUBLE_TYPE_SIZE -#ifdef __RX_32BIT_DOUBLES__ -#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 32 -#else -#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64 -#endif - #define DEFAULT_SIGNED_CHAR 0 /* RX load/store instructions can handle unaligned addresses. */ diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h index 2f2139e919b..c5edace139b 100644 --- a/gcc/config/s390/s390.h +++ b/gcc/config/s390/s390.h @@ -252,14 +252,6 @@ enum processor_flags #define DOUBLE_TYPE_SIZE 64 #define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64) -/* Define this to set long double type size to use in libgcc2.c, which can - not depend on target_flags. */ -#ifdef __LONG_DOUBLE_128__ -#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128 -#else -#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64 -#endif - /* Work around target_flags dependency in ada/targtyps.c. */ #define WIDEST_HARDWARE_FP_SIZE 64 diff --git a/gcc/config/sparc/freebsd.h b/gcc/config/sparc/freebsd.h index 371312bb4df..d89f11491f5 100644 --- a/gcc/config/sparc/freebsd.h +++ b/gcc/config/sparc/freebsd.h @@ -71,14 +71,6 @@ along with GCC; see the file COPYING3. If not see #undef LONG_DOUBLE_TYPE_SIZE #define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64) -/* Define this to set long double type size to use in libgcc2.c, which can - not depend on target_flags. */ -#if defined(__arch64__) || defined(__LONG_DOUBLE_128__) -#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128 -#else -#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64 -#endif - /* Definitions for 64-bit SPARC running systems with ELF. */ #define TARGET_ELF 1 diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h index c54ba2cb51c..277e49a5f49 100644 --- a/gcc/config/sparc/linux.h +++ b/gcc/config/sparc/linux.h @@ -122,14 +122,6 @@ do { \ SPARC ABI says that long double is 4 words. */ #define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64) -/* Define this to set long double type size to use in libgcc2.c, which can - not depend on target_flags. */ -#ifdef __LONG_DOUBLE_128__ -#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128 -#else -#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64 -#endif - #undef DITF_CONVERSION_LIBFUNCS #define DITF_CONVERSION_LIBFUNCS 1 diff --git a/gcc/config/sparc/linux64.h b/gcc/config/sparc/linux64.h index f00fb42ffab..7f1288126c0 100644 --- a/gcc/config/sparc/linux64.h +++ b/gcc/config/sparc/linux64.h @@ -70,14 +70,6 @@ along with GCC; see the file COPYING3. If not see #undef LONG_DOUBLE_TYPE_SIZE #define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64) -/* Define this to set long double type size to use in libgcc2.c, which can - not depend on target_flags. */ -#if defined(__arch64__) || defined(__LONG_DOUBLE_128__) -#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128 -#else -#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64 -#endif - #undef CPP_SUBTARGET_SPEC #define CPP_SUBTARGET_SPEC "\ %{posix:-D_POSIX_SOURCE} \ diff --git a/gcc/config/sparc/netbsd-elf.h b/gcc/config/sparc/netbsd-elf.h index 949d333f67c..5c74464269c 100644 --- a/gcc/config/sparc/netbsd-elf.h +++ b/gcc/config/sparc/netbsd-elf.h @@ -168,12 +168,6 @@ along with GCC; see the file COPYING3. If not see #undef LONG_DOUBLE_TYPE_SIZE #define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64) -#if defined(__arch64__) || defined(__LONG_DOUBLE_128__) -#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128 -#else -#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64 -#endif - #undef CC1_SPEC #if DEFAULT_ARCH32_P #define CC1_SPEC CC1_SPEC32 @@ -195,9 +189,6 @@ along with GCC; see the file COPYING3. If not see #undef LONG_DOUBLE_TYPE_SIZE #define LONG_DOUBLE_TYPE_SIZE 128 -#undef LIBGCC2_LONG_DOUBLE_TYPE_SIZE -#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128 - #undef CC1_SPEC #define CC1_SPEC CC1_SPEC64 @@ -210,9 +201,6 @@ along with GCC; see the file COPYING3. If not see #undef LONG_DOUBLE_TYPE_SIZE #define LONG_DOUBLE_TYPE_SIZE 64 -#undef LIBGCC2_LONG_DOUBLE_TYPE_SIZE -#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64 - #undef CC1_SPEC #define CC1_SPEC CC1_SPEC32 diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 396909f2619..10af50e1b8b 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -1542,13 +1542,6 @@ the target machine. If you don't define this, the default is @code{BITS_PER_UNIT * 16}. @end defmac -@defmac LIBGCC2_LONG_DOUBLE_TYPE_SIZE -Define this macro if @code{LONG_DOUBLE_TYPE_SIZE} is not constant or -if you want routines in @file{libgcc2.a} for a size other than -@code{LONG_DOUBLE_TYPE_SIZE}. If you don't define this, the -default is @code{LONG_DOUBLE_TYPE_SIZE}. -@end defmac - @defmac LIBGCC2_GNU_PREFIX This macro corresponds to the @code{TARGET_LIBFUNC_GNU_PREFIX} target hook and should be defined if that hook is overriden to be true. It diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index 798c1aad5e2..f6f241b5093 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -1384,13 +1384,6 @@ the target machine. If you don't define this, the default is @code{BITS_PER_UNIT * 16}. @end defmac -@defmac LIBGCC2_LONG_DOUBLE_TYPE_SIZE -Define this macro if @code{LONG_DOUBLE_TYPE_SIZE} is not constant or -if you want routines in @file{libgcc2.a} for a size other than -@code{LONG_DOUBLE_TYPE_SIZE}. If you don't define this, the -default is @code{LONG_DOUBLE_TYPE_SIZE}. -@end defmac - @defmac LIBGCC2_GNU_PREFIX This macro corresponds to the @code{TARGET_LIBFUNC_GNU_PREFIX} target hook and should be defined if that hook is overriden to be true. It diff --git a/gcc/system.h b/gcc/system.h index 3208a9d6f8c..dbe1ceb3d8a 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -936,7 +936,8 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN; EXTRA_CONSTRAINT_STR EXTRA_MEMORY_CONSTRAINT \ EXTRA_ADDRESS_CONSTRAINT CONST_DOUBLE_OK_FOR_CONSTRAINT_P \ CALLER_SAVE_PROFITABLE LARGEST_EXPONENT_IS_NORMAL \ - ROUND_TOWARDS_ZERO SF_SIZE DF_SIZE XF_SIZE TF_SIZE LIBGCC2_TF_CEXT + ROUND_TOWARDS_ZERO SF_SIZE DF_SIZE XF_SIZE TF_SIZE LIBGCC2_TF_CEXT \ + LIBGCC2_LONG_DOUBLE_TYPE_SIZE /* Hooks that are no longer used. */ #pragma GCC poison LANG_HOOKS_FUNCTION_MARK LANG_HOOKS_FUNCTION_FREE \ diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 9eb57755b8f..b43307062e8 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,16 @@ +2014-09-22 Joseph Myers + + * dfp-bit.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Remove. + (__LIBGCC_XF_MANT_DIG__): Define if not already defined. + (LONG_DOUBLE_HAS_XF_MODE): Define in terms of + __LIBGCC_XF_MANT_DIG__. + (__LIBGCC_TF_MANT_DIG__): Define if not already defined. + (LONG_DOUBLE_HAS_TF_MODE): Define in terms of + __LIBGCC_TF_MANT_DIG__. + * libgcc2.c (NOTRUNC): Define in terms of + __LIBGCC_*_EXCESS_PRECISION__, not LIBGCC2_LONG_DOUBLE_TYPE_SIZE. + * libgcc2.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Remove. + 2014-09-22 Joseph Myers PR target/63312 diff --git a/libgcc/dfp-bit.h b/libgcc/dfp-bit.h index 89dbd8fe89f..7a90a7298e5 100644 --- a/libgcc/dfp-bit.h +++ b/libgcc/dfp-bit.h @@ -34,19 +34,21 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "tm.h" #include "libgcc_tm.h" -#ifndef LIBGCC2_LONG_DOUBLE_TYPE_SIZE -#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE LONG_DOUBLE_TYPE_SIZE -#endif - /* We need to know the size of long double that the C library supports. Don't use LIBGCC2_HAS_XF_MODE or LIBGCC2_HAS_TF_MODE here because some targets set both of those. */ +#ifndef __LIBGCC_XF_MANT_DIG__ +#define __LIBGCC_XF_MANT_DIG__ 0 +#endif #define LONG_DOUBLE_HAS_XF_MODE \ - (BITS_PER_UNIT == 8 && LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 80) + (__LDBL_MANT_DIG__ == __LIBGCC_XF_MANT_DIG__) +#ifndef __LIBGCC_TF_MANT_DIG__ +#define __LIBGCC_TF_MANT_DIG__ 0 +#endif #define LONG_DOUBLE_HAS_TF_MODE \ - (BITS_PER_UNIT == 8 && LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128) + (__LDBL_MANT_DIG__ == __LIBGCC_TF_MANT_DIG__) /* Depending on WIDTH, define a number of macros: diff --git a/libgcc/libgcc2.c b/libgcc/libgcc2.c index dc8a235e8b8..46d6a2ef030 100644 --- a/libgcc/libgcc2.c +++ b/libgcc/libgcc2.c @@ -1866,29 +1866,25 @@ NAME (TYPE x, int m) # define CTYPE SCtype # define MODE sc # define CEXT __LIBGCC_SF_FUNC_EXT__ -# define NOTRUNC __FLT_EVAL_METHOD__ == 0 +# define NOTRUNC __LIBGCC_SF_EXCESS_PRECISION__ #elif defined(L_muldc3) || defined(L_divdc3) # define MTYPE DFtype # define CTYPE DCtype # define MODE dc # define CEXT __LIBGCC_DF_FUNC_EXT__ -# if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 64 -# define NOTRUNC 1 -# else -# define NOTRUNC __FLT_EVAL_METHOD__ == 0 || __FLT_EVAL_METHOD__ == 1 -# endif +# define NOTRUNC __LIBGCC_DF_EXCESS_PRECISION__ #elif defined(L_mulxc3) || defined(L_divxc3) # define MTYPE XFtype # define CTYPE XCtype # define MODE xc # define CEXT __LIBGCC_XF_FUNC_EXT__ -# define NOTRUNC 1 +# define NOTRUNC __LIBGCC_XF_EXCESS_PRECISION__ #elif defined(L_multc3) || defined(L_divtc3) # define MTYPE TFtype # define CTYPE TCtype # define MODE tc # define CEXT __LIBGCC_TF_FUNC_EXT__ -# define NOTRUNC 1 +# define NOTRUNC __LIBGCC_TF_EXCESS_PRECISION__ #else # error #endif diff --git a/libgcc/libgcc2.h b/libgcc/libgcc2.h index 597b0ac1de7..c9ddce2876b 100644 --- a/libgcc/libgcc2.h +++ b/libgcc/libgcc2.h @@ -34,10 +34,6 @@ extern void __clear_cache (char *, char *); extern void __eprintf (const char *, const char *, unsigned int, const char *) __attribute__ ((__noreturn__)); -#ifndef LIBGCC2_LONG_DOUBLE_TYPE_SIZE -#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE LONG_DOUBLE_TYPE_SIZE -#endif - #ifdef __LIBGCC_HAS_SF_MODE__ #define LIBGCC2_HAS_SF_MODE 1 #else -- 2.30.2