summaryrefslogtreecommitdiff
path: root/gcc/config/i386
diff options
context:
space:
mode:
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2014-09-12 12:05:18 +0000
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2014-09-12 12:05:18 +0000
commitd5957f0dc328e1eb73bad7115b7efe860c949684 (patch)
tree92677961221518f05fe5f99181dfc56695366926 /gcc/config/i386
parent7f96f6527707998a24a6364137e5a06febb060d8 (diff)
downloadgcc-d5957f0dc328e1eb73bad7115b7efe860c949684.tar.gz
Remove LIBGCC2_HAS_?F_MODE target macros.
This patch removes the LIBGCC2_HAS_{SF,DF,XF,TF}_MODE target macros, replacing them by predefines with -fbuilding-libgcc, together with a target hook that can influence those predefines when needed. The new default is that a floating-point mode is supported in libgcc if (a) it passes the scalar_mode_supported_p hook (otherwise it's not plausible for it to be supported in libgcc) and (b) it's one of those four modes (since those are the modes for which libgcc hardcodes the possibility of support). The target hook can override the default choice (in either direction) for modes that pass scalar_mode_supported_p (although overriding in the direction of returning true when the default would return false only makes sense if all relevant functions are specially defined in libgcc for that particular target). The previous default settings depended on various settings such as LIBGCC2_LONG_DOUBLE_TYPE_SIZE, as well as targets defining the above target macros if the default wasn't correct. The default scalar_mode_supported_p only declares a floating-point mode to be supported if it matches one of float / double / long double. This means that in most cases where a mode is only supported conditionally in libgcc (TFmode only supported if it's the mode of long double, most commonly), the default gets things right. Overrides were needed in the following cases: * SFmode would always have been supported in libgcc (the condition was BITS_PER_UNIT == 8, true for all current targets), but pdp11 defaults to 64-bit float, and in that case SFmode would fail scalar_mode_supported_p. I don't know if libgcc actually built for pdp11 (and the port may well no longer be being used), but this patch adds a scalar_mode_supported_p hook to it to ensure SFmode is treated as supported. * Certain i386 and ia64 targets need the new hook to match the existing cases for when XFmode or TFmode support is present in libgcc. For i386, the hook can always declare XFmode to be supported - the cases where it's not are the cases where long double is TFmode, in which case XFmode fails scalar_mode_supported_p[*] - but TFmode support needs to be conditional. (And of the targets not defining LIBGCC2_HAS_TF_MODE before this patch, some defined LONG_DOUBLE_TYPE_SIZE to 64, so ensuring LIBGCC2_HAS_TF_MODE would always be false, while others did not define it, so allowing it to be true in the -mlong-double-128 case. This patch matches that logic, although I suspect all the latter targets would have been broken if you tried to enable -mlong-double-128 by default, for lack of the soft-fp TFmode support in libgcc, which is separately configured.) [*] I don't know if it's deliberate not to support __float80 at all with -mlong-double-128. In order to implement the default version of the new hook, insn-modes.h was made to contain macros such as HAVE_TFmode for each machine mode, so the default hook can contain conditionals on whether XFmode and TFmode exist (to match the hardcoding of a list of modes in libgcc). This is also used in fortran/trans-types.c; previously it had a conditional on defined(LIBGCC2_HAS_TF_MODE) (a bit dubious, since it ignored the value of the macro), which is replaced by testing defined(HAVE_TFmode), in conjunction with requiring targetm.libgcc_floating_mode_supported_p. (Fortran is testing something stronger than that hook: not only is libgcc support required, but also libm or equivalent. Thus, it has a test for ENABLE_LIBQUADMATH_SUPPORT in the case that the mode is TFmode and that's not the same as any of the three standard types. The old and new tests are intended to accept exactly the same set of modes for all targets.) Apart from the four target macros eliminated by this patch, it gets us closer to eliminating LIBGCC2_LONG_DOUBLE_TYPE_SIZE as well, though a few more places using that macro need changing first. Bootstrapped with no regressions on x86_64-unknown-linux-gnu; also built cc1 for crosses to ia64-elf and pdp11-none as a minimal test of changes for those targets. gcc: * target.def (libgcc_floating_mode_supported_p): New hook. * targhooks.c (default_libgcc_floating_mode_supported_p): New function. * targhooks.h (default_libgcc_floating_mode_supported_p): Declare. * doc/tm.texi.in (LIBGCC2_HAS_DF_MODE, LIBGCC2_HAS_XF_MODE) (LIBGCC2_HAS_TF_MODE): Remove. (TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P): New @hook. * doc/tm.texi: Regenerate. * genmodes.c (emit_insn_modes_h): Define HAVE_%smode for each machine mode. * system.h (LIBGCC2_HAS_SF_MODE, LIBGCC2_HAS_DF_MODE) (LIBGCC2_HAS_XF_MODE, LIBGCC2_HAS_TF_MODE): Poison. * config/i386/cygming.h (LIBGCC2_HAS_TF_MODE): Remove. * config/i386/darwin.h (LIBGCC2_HAS_TF_MODE): Remove. * config/i386/djgpp.h (IX86_MAYBE_NO_LIBGCC_TFMODE): Define. * config/i386/dragonfly.h (LIBGCC2_HAS_TF_MODE): Remove. * config/i386/freebsd.h (LIBGCC2_HAS_TF_MODE): Remove. * config/i386/gnu-user-common.h (LIBGCC2_HAS_TF_MODE): Remove. * config/i386/i386-interix.h (IX86_NO_LIBGCC_TFMODE): Define. * config/i386/i386.c (ix86_libgcc_floating_mode_supported_p): New function. (TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P): Define. * config/i386/i386elf.h (IX86_MAYBE_NO_LIBGCC_TFMODE): Define. * config/i386/lynx.h (IX86_MAYBE_NO_LIBGCC_TFMODE): Define. * config/i386/netbsd-elf.h (IX86_MAYBE_NO_LIBGCC_TFMODE): Define. * config/i386/netbsd64.h (IX86_MAYBE_NO_LIBGCC_TFMODE): Define. * config/i386/nto.h (IX86_MAYBE_NO_LIBGCC_TFMODE): Define. * config/i386/openbsd.h (IX86_MAYBE_NO_LIBGCC_TFMODE): Define. * config/i386/openbsdelf.h (LIBGCC2_HAS_TF_MODE): Remove. * config/i386/rtemself.h (IX86_NO_LIBGCC_TFMODE): Define. * config/i386/sol2.h (LIBGCC2_HAS_TF_MODE): Remove. * config/i386/vx-common.h (IX86_MAYBE_NO_LIBGCC_TFMODE): Define. * config/ia64/elf.h (IA64_NO_LIBGCC_TFMODE): Define. * config/ia64/freebsd.h (IA64_NO_LIBGCC_TFMODE): Define. * config/ia64/hpux.h (LIBGCC2_HAS_XF_MODE, LIBGCC2_HAS_TF_MODE): Remove. * config/ia64/ia64.c (TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P): New macro. (ia64_libgcc_floating_mode_supported_p): New function. * config/ia64/linux.h (LIBGCC2_HAS_TF_MODE): Remove. * config/ia64/vms.h (IA64_NO_LIBGCC_XFMODE) (IA64_NO_LIBGCC_TFMODE): Define. * config/msp430/msp430.h (LIBGCC2_HAS_DF_MODE): Remove. * config/pdp11/pdp11.c (TARGET_SCALAR_MODE_SUPPORTED_P): New macro. (pdp11_scalar_mode_supported_p): New function. * config/rl78/rl78.h (LIBGCC2_HAS_DF_MODE): Remove. * config/rx/rx.h (LIBGCC2_HAS_DF_MODE): Remove. gcc/c-family: * c-cppbuiltin.c (c_cpp_builtins): Define __LIBGCC_HAS_%s_MODE__ macros for floating-point modes. gcc/fortran: * trans-types.c (gfc_init_kinds): Check targetm.libgcc_floating_mode_supported_p for floating-point modes. Check HAVE_TFmode instead of LIBGCC2_HAS_TF_MODE. libgcc: * libgcc2.h (LIBGCC2_HAS_SF_MODE): Define using __LIBGCC_HAS_SF_MODE__. (LIBGCC2_HAS_DF_MODE): Define using __LIBGCC_HAS_DF_MODE__. (LIBGCC2_HAS_XF_MODE): Define using __LIBGCC_HAS_XF_MODE__. (LIBGCC2_HAS_TF_MODE): Define using __LIBGCC_HAS_TF_MODE__. * config/libbid/bid_gcc_intrinsics.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Do not define. (LIBGCC2_HAS_XF_MODE): Define using __LIBGCC_HAS_XF_MODE__. (LIBGCC2_HAS_TF_MODE): Define using __LIBGCC_HAS_TF_MODE__. * fixed-bit.h (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Do not define. (LIBGCC2_HAS_SF_MODE): Define using __LIBGCC_HAS_SF_MODE__. (LIBGCC2_HAS_DF_MODE): Define using __LIBGCC_HAS_DF_MODE__. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@215215 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/i386')
-rw-r--r--gcc/config/i386/cygming.h2
-rw-r--r--gcc/config/i386/darwin.h2
-rw-r--r--gcc/config/i386/djgpp.h2
-rw-r--r--gcc/config/i386/dragonfly.h2
-rw-r--r--gcc/config/i386/freebsd.h2
-rw-r--r--gcc/config/i386/gnu-user-common.h2
-rw-r--r--gcc/config/i386/i386-interix.h2
-rw-r--r--gcc/config/i386/i386.c29
-rw-r--r--gcc/config/i386/i386elf.h2
-rw-r--r--gcc/config/i386/lynx.h2
-rw-r--r--gcc/config/i386/netbsd-elf.h2
-rw-r--r--gcc/config/i386/netbsd64.h2
-rw-r--r--gcc/config/i386/nto.h2
-rw-r--r--gcc/config/i386/openbsd.h2
-rw-r--r--gcc/config/i386/openbsdelf.h2
-rw-r--r--gcc/config/i386/rtemself.h2
-rw-r--r--gcc/config/i386/sol2.h2
-rw-r--r--gcc/config/i386/vx-common.h2
18 files changed, 49 insertions, 14 deletions
diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h
index 98d652be5ee..a2c3773a966 100644
--- a/gcc/config/i386/cygming.h
+++ b/gcc/config/i386/cygming.h
@@ -340,8 +340,6 @@ do { \
asm_output_aligned_bss ((FILE), (DECL), (NAME), (SIZE), (ALIGN))
/* Put all *tf routines in libgcc. */
-#undef LIBGCC2_HAS_TF_MODE
-#define LIBGCC2_HAS_TF_MODE 1
#define LIBGCC2_TF_CEXT q
/* Output function declarations at the end of the file. */
diff --git a/gcc/config/i386/darwin.h b/gcc/config/i386/darwin.h
index f6a5b6b0e97..cafc98a9ad2 100644
--- a/gcc/config/i386/darwin.h
+++ b/gcc/config/i386/darwin.h
@@ -154,8 +154,6 @@ extern int darwin_emit_branch_islands;
#define SHIFT_DOUBLE_OMITS_COUNT 0
/* Put all *tf routines in libgcc. */
-#undef LIBGCC2_HAS_TF_MODE
-#define LIBGCC2_HAS_TF_MODE 1
#define LIBGCC2_TF_CEXT q
#undef TARGET_ASM_FILE_END
diff --git a/gcc/config/i386/djgpp.h b/gcc/config/i386/djgpp.h
index 0f3718f340a..6f8cbd2363c 100644
--- a/gcc/config/i386/djgpp.h
+++ b/gcc/config/i386/djgpp.h
@@ -177,3 +177,5 @@ while (0)
/* Support for C++ templates. */
#undef MAKE_DECL_ONE_ONLY
#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
+
+#define IX86_MAYBE_NO_LIBGCC_TFMODE
diff --git a/gcc/config/i386/dragonfly.h b/gcc/config/i386/dragonfly.h
index ed5f508f7ed..b46a13ecfa5 100644
--- a/gcc/config/i386/dragonfly.h
+++ b/gcc/config/i386/dragonfly.h
@@ -90,8 +90,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define TARGET_96_ROUND_53_LONG_DOUBLE (!TARGET_64BIT)
/* Put all *tf routines in libgcc. */
-#undef LIBGCC2_HAS_TF_MODE
-#define LIBGCC2_HAS_TF_MODE 1
#define LIBGCC2_TF_CEXT q
/* Static stack checking is supported by means of probes. */
diff --git a/gcc/config/i386/freebsd.h b/gcc/config/i386/freebsd.h
index 25ab5468d99..b09bfd023fe 100644
--- a/gcc/config/i386/freebsd.h
+++ b/gcc/config/i386/freebsd.h
@@ -132,8 +132,6 @@ along with GCC; see the file COPYING3. If not see
#define TARGET_96_ROUND_53_LONG_DOUBLE (!TARGET_64BIT)
/* Put all *tf routines in libgcc. */
-#undef LIBGCC2_HAS_TF_MODE
-#define LIBGCC2_HAS_TF_MODE 1
#define LIBGCC2_TF_CEXT q
/* Static stack checking is supported by means of probes. */
diff --git a/gcc/config/i386/gnu-user-common.h b/gcc/config/i386/gnu-user-common.h
index e01491a4737..5f1973567c3 100644
--- a/gcc/config/i386/gnu-user-common.h
+++ b/gcc/config/i386/gnu-user-common.h
@@ -58,8 +58,6 @@ along with GCC; see the file COPYING3. If not see
GNU_USER_TARGET_ENDFILE_SPEC
/* Put all *tf routines in libgcc. */
-#undef LIBGCC2_HAS_TF_MODE
-#define LIBGCC2_HAS_TF_MODE 1
#define LIBGCC2_TF_CEXT q
#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
diff --git a/gcc/config/i386/i386-interix.h b/gcc/config/i386/i386-interix.h
index 59bbb508de2..49aef842f76 100644
--- a/gcc/config/i386/i386-interix.h
+++ b/gcc/config/i386/i386-interix.h
@@ -143,6 +143,8 @@ do { \
#undef LIBGCC2_LONG_DOUBLE_TYPE_SIZE
#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
+#define IX86_NO_LIBGCC_TFMODE
+
#undef TARGET_LIBC_HAS_FUNCTION
#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index cb308c9ee95..30120a56b74 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -41218,6 +41218,31 @@ ix86_vector_mode_supported_p (enum machine_mode mode)
return false;
}
+/* Implement target hook libgcc_floating_mode_supported_p. */
+static bool
+ix86_libgcc_floating_mode_supported_p (enum machine_mode mode)
+{
+ switch (mode)
+ {
+ case SFmode:
+ case DFmode:
+ case XFmode:
+ return true;
+
+ case TFmode:
+#ifdef IX86_NO_LIBGCC_TFMODE
+ return false;
+#elif defined IX86_MAYBE_NO_LIBGCC_TFMODE
+ return TARGET_LONG_DOUBLE_128;
+#else
+ return true;
+#endif
+
+ default:
+ return false;
+ }
+}
+
/* Target hook for c_mode_for_suffix. */
static enum machine_mode
ix86_c_mode_for_suffix (char suffix)
@@ -47283,6 +47308,10 @@ ix86_atomic_assign_expand_fenv (tree *hold, tree *clear, tree *update)
#undef TARGET_VECTOR_MODE_SUPPORTED_P
#define TARGET_VECTOR_MODE_SUPPORTED_P ix86_vector_mode_supported_p
+#undef TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P
+#define TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P \
+ ix86_libgcc_floating_mode_supported_p
+
#undef TARGET_C_MODE_FOR_SUFFIX
#define TARGET_C_MODE_FOR_SUFFIX ix86_c_mode_for_suffix
diff --git a/gcc/config/i386/i386elf.h b/gcc/config/i386/i386elf.h
index 73e119dddd3..36a0390459f 100644
--- a/gcc/config/i386/i386elf.h
+++ b/gcc/config/i386/i386elf.h
@@ -101,3 +101,5 @@ along with GCC; see the file COPYING3. If not see
#undef ASM_OUTPUT_ALIGNED_BSS
#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
+
+#define IX86_MAYBE_NO_LIBGCC_TFMODE
diff --git a/gcc/config/i386/lynx.h b/gcc/config/i386/lynx.h
index 910930e71fd..e7a593b7174 100644
--- a/gcc/config/i386/lynx.h
+++ b/gcc/config/i386/lynx.h
@@ -85,3 +85,5 @@ along with GCC; see the file COPYING3. If not see
TLS is detected by configure. We undefine it here. */
#undef HAVE_AS_TLS
+
+#define IX86_MAYBE_NO_LIBGCC_TFMODE
diff --git a/gcc/config/i386/netbsd-elf.h b/gcc/config/i386/netbsd-elf.h
index e575b39cbde..8f4cc703ad2 100644
--- a/gcc/config/i386/netbsd-elf.h
+++ b/gcc/config/i386/netbsd-elf.h
@@ -119,3 +119,5 @@ along with GCC; see the file COPYING3. If not see
#define DEFAULT_PCC_STRUCT_RETURN 1
#define HAVE_ENABLE_EXECUTE_STACK
+
+#define IX86_MAYBE_NO_LIBGCC_TFMODE
diff --git a/gcc/config/i386/netbsd64.h b/gcc/config/i386/netbsd64.h
index f990835bd0f..d748f7d33cf 100644
--- a/gcc/config/i386/netbsd64.h
+++ b/gcc/config/i386/netbsd64.h
@@ -67,3 +67,5 @@ along with GCC; see the file COPYING3. If not see
}
#define HAVE_ENABLE_EXECUTE_STACK
+
+#define IX86_MAYBE_NO_LIBGCC_TFMODE
diff --git a/gcc/config/i386/nto.h b/gcc/config/i386/nto.h
index 2abb9875151..d93d0866a24 100644
--- a/gcc/config/i386/nto.h
+++ b/gcc/config/i386/nto.h
@@ -103,3 +103,5 @@ crti.o%s \
#define TARGET_POSIX_IO
#undef DBX_REGISTER_NUMBER
+
+#define IX86_MAYBE_NO_LIBGCC_TFMODE
diff --git a/gcc/config/i386/openbsd.h b/gcc/config/i386/openbsd.h
index f313d5cd1d5..3ee47646c91 100644
--- a/gcc/config/i386/openbsd.h
+++ b/gcc/config/i386/openbsd.h
@@ -99,3 +99,5 @@ along with GCC; see the file COPYING3. If not see
#undef ASM_QUAD
#define TARGET_HAVE_NAMED_SECTIONS false
+
+#define IX86_MAYBE_NO_LIBGCC_TFMODE
diff --git a/gcc/config/i386/openbsdelf.h b/gcc/config/i386/openbsdelf.h
index 06913eb2b2e..8e2eceab933 100644
--- a/gcc/config/i386/openbsdelf.h
+++ b/gcc/config/i386/openbsdelf.h
@@ -113,6 +113,4 @@ along with GCC; see the file COPYING3. If not see
#define HAVE_ENABLE_EXECUTE_STACK
/* Put all *tf routines in libgcc. */
-#undef LIBGCC2_HAS_TF_MODE
-#define LIBGCC2_HAS_TF_MODE 1
#define LIBGCC2_TF_CEXT q
diff --git a/gcc/config/i386/rtemself.h b/gcc/config/i386/rtemself.h
index 7c3a19ce6eb..ce6d762948d 100644
--- a/gcc/config/i386/rtemself.h
+++ b/gcc/config/i386/rtemself.h
@@ -38,3 +38,5 @@ along with GCC; see the file COPYING3. If not see
#else
#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 80
#endif
+
+#define IX86_NO_LIBGCC_TFMODE
diff --git a/gcc/config/i386/sol2.h b/gcc/config/i386/sol2.h
index 5c9232360d1..be1e6fcff0d 100644
--- a/gcc/config/i386/sol2.h
+++ b/gcc/config/i386/sol2.h
@@ -238,6 +238,4 @@ along with GCC; see the file COPYING3. If not see
#endif
/* Put all *tf routines in libgcc. */
-#undef LIBGCC2_HAS_TF_MODE
-#define LIBGCC2_HAS_TF_MODE 1
#define LIBGCC2_TF_CEXT q
diff --git a/gcc/config/i386/vx-common.h b/gcc/config/i386/vx-common.h
index 136c2d9af37..dd096f10fe0 100644
--- a/gcc/config/i386/vx-common.h
+++ b/gcc/config/i386/vx-common.h
@@ -31,3 +31,5 @@ along with GCC; see the file COPYING3. If not see
#undef DBX_REGISTER_NUMBER
#define DBX_REGISTER_NUMBER(n) svr4_dbx_register_map[n]
+
+#define IX86_MAYBE_NO_LIBGCC_TFMODE