gcc/libgcc/config
Joseph Myers 8cc4b7a26d 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__.

From-SVN: r215215
2014-09-12 13:05:18 +01:00
..
aarch64 Add crtfastmath for AArch64. 2014-09-09 15:53:01 +00:00
alpha Use -fbuilding-libgcc for more target macros used in libgcc. 2014-09-05 13:03:46 +01:00
arc Update copyright years in libgcc/ 2014-01-02 22:25:22 +00:00
arm bpabi.c (__gnu_uldivmod_helper): Remove. 2014-06-18 15:44:45 +00:00
avr re PR target/63223 ([avr] Make jumptables work with -Wl,--section-start,.text=) 2014-09-11 08:08:17 +00:00
bfin Update copyright years in libgcc/ 2014-01-02 22:25:22 +00:00
c6x float128-mul-underflow.c, [...]: New tests. 2014-02-12 23:24:49 +00:00
cr16 Use -fbuilding-libgcc for more target macros used in libgcc. 2014-09-05 13:03:46 +01:00
cris float128-mul-underflow.c, [...]: New tests. 2014-02-12 23:24:49 +00:00
epiphany Update copyright years in libgcc/ 2014-01-02 22:25:22 +00:00
fr30 Update copyright years in libgcc/ 2014-01-02 22:25:22 +00:00
frv Update copyright years in libgcc/ 2014-01-02 22:25:22 +00:00
h8300 Update copyright years in libgcc/ 2014-01-02 22:25:22 +00:00
i386 Use -fbuilding-libgcc for more target macros used in libgcc. 2014-09-05 13:03:46 +01:00
ia64 float128-mul-underflow.c, [...]: New tests. 2014-02-12 23:24:49 +00:00
iq2000 Update copyright years in libgcc/ 2014-01-02 22:25:22 +00:00
libbid Remove LIBGCC2_HAS_?F_MODE target macros. 2014-09-12 13:05:18 +01:00
lm32 float128-mul-underflow.c, [...]: New tests. 2014-02-12 23:24:49 +00:00
m32c Update copyright years in libgcc/ 2014-01-02 22:25:22 +00:00
m32r Update copyright years in libgcc/ 2014-01-02 22:25:22 +00:00
m68k Update copyright years in libgcc/ 2014-01-02 22:25:22 +00:00
mcore Update copyright years in libgcc/ 2014-01-02 22:25:22 +00:00
mep Update copyright years in libgcc/ 2014-01-02 22:25:22 +00:00
microblaze Update copyright years in libgcc/ 2014-01-02 22:25:22 +00:00
mips Use -fbuilding-libgcc for more target macros used in libgcc. 2014-09-05 13:03:46 +01:00
mmix Update copyright years in libgcc/ 2014-01-02 22:25:22 +00:00
moxie float128-mul-underflow.c, [...]: New tests. 2014-02-12 23:24:49 +00:00
msp430 t-msp430 (HOST_LIBGCC2_CFLAGS): Add -mhwmult=none. 2014-05-22 15:15:36 +00:00
nds32 float128-mul-underflow.c, [...]: New tests. 2014-02-12 23:24:49 +00:00
nios2 Use -fbuilding-libgcc for more target macros used in libgcc. 2014-09-05 13:03:46 +01:00
pa Use -fbuilding-libgcc for more target macros used in libgcc. 2014-09-05 13:03:46 +01:00
pdp11
rl78 Update copyright years in libgcc/ 2014-01-02 22:25:22 +00:00
rs6000 Use -fbuilding-libgcc for more target macros used in libgcc. 2014-09-05 13:03:46 +01:00
rx Update copyright years in libgcc/ 2014-01-02 22:25:22 +00:00
s390 s390.c (s390_emit_tpf_eh_return): Pass original return address as second parameter to __tpf_eh_return routine. 2014-07-30 16:26:15 +00:00
score float128-mul-underflow.c, [...]: New tests. 2014-02-12 23:24:49 +00:00
sh Update copyright years in libgcc/ 2014-01-02 22:25:22 +00:00
sparc Use -fbuilding-libgcc for more target macros used in libgcc. 2014-09-05 13:03:46 +01:00
spu Update copyright years in libgcc/ 2014-01-02 22:25:22 +00:00
stormy16 Update copyright years in libgcc/ 2014-01-02 22:25:22 +00:00
tilegx TILE-Gx big endian support. 2014-02-24 15:08:00 +00:00
tilepro Use -fbuilding-libgcc for more target macros used in libgcc. 2014-09-05 13:03:46 +01:00
v850 Update copyright years in libgcc/ 2014-01-02 22:25:22 +00:00
vax Update copyright years in libgcc/ 2014-01-02 22:25:22 +00:00
vms Update copyright years in libgcc/ 2014-01-02 22:25:22 +00:00
xtensa Use -fbuilding-libgcc for more target macros used in libgcc. 2014-09-05 13:03:46 +01:00
darwin-64.c Update copyright years in libgcc/ 2014-01-02 22:25:22 +00:00
darwin-crt3.c Update copyright years in libgcc/ 2014-01-02 22:25:22 +00:00
darwin-crt-tm.c Update copyright years in libgcc/ 2014-01-02 22:25:22 +00:00
gmon-sol2.c
gthr-lynx.h Update copyright years in libgcc/ 2014-01-02 22:25:22 +00:00
gthr-rtems.h Update copyright years in libgcc/ 2014-01-02 22:25:22 +00:00
gthr-vxworks.h Update copyright years in libgcc/ 2014-01-02 22:25:22 +00:00
hardfp.c configure.ac (libgcc_cv_mips_hard_float): New. 2014-02-07 07:46:34 +00:00
libgcc-glibc.ver Update copyright years in libgcc/ 2014-01-02 22:25:22 +00:00
libgcc-libsystem.ver
no-sfp-machine.h
no-unwind.h
t-crtfm
t-crtstuff-pic
t-darwin
t-dfprules
t-eh-dw2-dip
t-fdpbit
t-fixedpoint-gnu-prefix
t-fpbit
t-freebsd-thread
t-gnu-prefix
t-hardfp configure.ac (libgcc_cv_mips_hard_float): New. 2014-02-07 07:46:34 +00:00
t-hardfp-sfdf configure.ac (libgcc_cv_mips_hard_float): New. 2014-02-07 07:46:34 +00:00
t-libgcc-pic
t-libunwind
t-libunwind-elf Update copyright years in libgcc/ 2014-01-02 22:25:22 +00:00
t-linux
t-openbsd-thread
t-rtems
t-slibgcc Update copyright years in libgcc/ 2014-01-02 22:25:22 +00:00
t-slibgcc-darwin
t-slibgcc-elf-ver
t-slibgcc-gld
t-slibgcc-gld-nover
t-slibgcc-hpux
t-slibgcc-libgcc Update copyright years in libgcc/ 2014-01-02 22:25:22 +00:00
t-slibgcc-nolc-override
t-slibgcc-sld Don't build libgcc-unwind.map with --disable-shared (PR libgcc/61097) 2014-05-08 12:11:14 +00:00
t-slibgcc-vms
t-softfp Update copyright years in libgcc/ 2014-01-02 22:25:22 +00:00
t-softfp-excl
t-softfp-sfdf
t-softfp-tf
t-sol2 Update copyright years in libgcc/ 2014-01-02 22:25:22 +00:00
t-stack
t-tls
t-vxworks
unwind-dw2-fde-darwin.c Update copyright years in libgcc/ 2014-01-02 22:25:22 +00:00
vxlib-tls.c Update copyright years in libgcc/ 2014-01-02 22:25:22 +00:00
vxlib.c Update copyright years in libgcc/ 2014-01-02 22:25:22 +00:00