From c15c90bbfe4553f5413341d61e8aa29caf2f647f Mon Sep 17 00:00:00 2001 From: Zack Weinberg Date: Thu, 2 Oct 2003 00:44:29 +0000 Subject: target.h (init_libfuncs): New hook. * target.h (init_libfuncs): New hook. * target-def.h: Default TARGET_INIT_BUILTINS and TARGET_INIT_LIBFUNCS to hook_void_void. Add TARGET_INIT_LIBFUNCS to TARGET_INITIALIZER. * builtins.c (default_init_builtins): Delete. * expr.h (default_init_builtins): Delete prototype. * doc/tm.texi: Document TARGET_INIT_LIBFUNCS and US_SOFTWARE_GOFAST. Tweak documentation of TARGET_FLOAT_LIB_COMPARE_RETURNS_BOOL. Remove documentation of INIT_TARGET_OPTABS, MULSI3_LIBCALL, DIVSI3_LIBCALL, UDIVSI3_LIBCALL, MODSI3_LIBCALL, UMODSI3_LIBCALL, MULDI3_LIBCALL, DIVDI3_LIBCALL, UDIVDI3_LIBCALL, MODDI3_LIBCALL, and UMODDI3_LIBCALL, * Makefile.in (optabs.o): Depends on target.h. * defaults.h: Provide default for FLOAT_LIB_COMPARE_RETURNS_BOOL. * optabs.c: Include target.h. (prepare_float_lib_cmp): No need for #ifdef around use of FLOAT_LIB_COMPARE_RETURNS_BOOL. (set_optab_libfunc): New function. (init_optabs): Delete use of all *_LIBCALL defines. Call targetm.init_libfuncs not INIT_TARGET_OPTABS. * optabs.h: Prototype set_optab_libfunc. * config.gcc: Remove all references to pa/long_double.h, ia64/hpux_longdouble.h, and gofast.h. (mips-*-*): When --enable-gofast, just add US_SOFTWARE_GOFAST to tm_defines; don't set INIT_SUBTARGET_OPTABS or change tm_file. * config/alpha/alpha.c, config/c4x/c4x.c, config/cris/cris.c * config/frv/frv.c, config/h8300/h8300.c, config/i860/i860.c * config/ia64/ia64.c, config/ip2k/ip2k.c, config/m68hc11/m68hc11.c * config/mips/mips.c, config/pa/pa.c, config/rs6000/rs6000.c * config/sparc/sparc.c, config/vax/vax.c: Provide a definition for TARGET_INIT_LIBFUNCS. Where necessary, include optabs.h, libfuncs.h, and/or config/gofast.h. * config/alpha/unicosmk.h, config/alpha/vms.h, config/c4x/c4x.h * config/avr/avr.h, config/cris/cris.h, config/frv/frv.h * config/h8300/h8300.h, config/i860/i860.h, config/ip2k/ip2k.h * config/iq2000/iq2000.h, config/m68hc11/m68hc11.h, config/mips/mips.h * config/rs6000/aix.h, config/rs6000/sysv4.h, config/sparc/elf.h * config/sparc/lite.h, config/sparc/netbsd-elf.h, config/sparc/sol2.h * config/sparc/sparc.h, config/v850/v850.h, config/vax/vax.h * config/vax/elf.h: Don't define or use INIT_TARGET_OPTABS, INIT_SUBTARGET_OPTABS, or any *_LIBCALL macros. * config/ia64/hpux.h: Redefine INTEL_EXTENDED_IEEE_FORMAT to 0. Set TARGET_INIT_LIBFUNCS and FLOAT_LIB_COMPARE_RETURNS_BOOL here. * config/pa/pa-hpux.h: Define LONG_DOUBLE_TYPE_SIZE, HPUX_LONG_DOUBLE_LIBRARY, and FLOAT_LIB_COMPARE_RETURNS_BOOL here. * config/ia64/hpux_longdouble.h, config/pa/long_double.h: Delete. * config/rs6000/xcoff.h: Don't define RS6000_ITRUNC nor RS6000_UITRUNC. * config/sparc/sparc.h: Default SUN_CONVERSION_LIBFUNCS and SUN_INTEGER_MULTIPLY_64 to 0. * config/sparc/sol2.h: Redefine SUN_CONVERSION_LIBFUNCS and SUN_INTEGER_MULTIPLY_64 to 1. * config/sparc/elf.h: Redefine SUN_CONVERSION_LIBFUNCS and SUN_INTEGER_MULTIPLY_64 to 0. * config/sparc/lite.h, config/sparc/liteelf.h, config/sparc/sp86x-elf.h: Define US_SOFTWARE_GOFAST. * config/vax/vax.h: Default TARGET_ELF to 0. * config/vax/elf.h: Redefine TARGET_ELF to 1. * config/gofast.h: Don't define any macros here. Provide one static function, gofast_maybe_init_libfuncs, which does what INIT_GOFAST_LIBFUNCS used to do but only if US_SOFTWARE_GOFAST is already defined. Do not clear negation libfuncs. Do not mess with HFmode, XFmode, or TFmode libfuncs. * config/avr/avr.c (avr_init_once): #if 0 out; mark FIXME. From-SVN: r72009 --- gcc/config/gofast.h | 137 +++++++++++++++++++++------------------------------- 1 file changed, 54 insertions(+), 83 deletions(-) (limited to 'gcc/config/gofast.h') diff --git a/gcc/config/gofast.h b/gcc/config/gofast.h index 3af267c..74a22c7 100644 --- a/gcc/config/gofast.h +++ b/gcc/config/gofast.h @@ -1,5 +1,5 @@ /* US Software GOFAST floating point library support. - Copyright (C) 1994, 1998, 1999, 2002 Free Software Foundation, Inc. + Copyright (C) 1994, 1998, 1999, 2002, 2003 Free Software Foundation, Inc. This file is part of GCC. @@ -18,91 +18,62 @@ along with GCC; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* This is used by fp-bit.c. */ -#define US_SOFTWARE_GOFAST - /* The US Software GOFAST library requires special optabs support. - There is no negation libcall, and several others have names different - from gcc. This file consolidates the support in one place. + This file is intended to be included by config/ARCH/ARCH.c. It + defines one function, gofast_maybe_init_libfuncs, which should be + called from the TARGET_INIT_LIBFUNCS hook. When tm.h has defined + US_SOFTWARE_GOFAST, this function will adjust all the optabs and + libfuncs appropriately. Otherwise it will do nothing. */ + +static void +gofast_maybe_init_libfuncs (void) +{ +#ifdef US_SOFTWARE_GOFAST + int mode; + + set_optab_libfunc (add_optab, SFmode, "fpadd"); + set_optab_libfunc (add_optab, DFmode, "dpadd"); + set_optab_libfunc (sub_optab, SFmode, "fpsub"); + set_optab_libfunc (sub_optab, DFmode, "dpsub"); + set_optab_libfunc (smul_optab, SFmode, "fpmul"); + set_optab_libfunc (smul_optab, DFmode, "dpmul"); + set_optab_libfunc (sdiv_optab, SFmode, "fpdiv"); + set_optab_libfunc (sdiv_optab, DFmode, "dpdiv"); + set_optab_libfunc (cmp_optab, SFmode, "fpcmp"); + set_optab_libfunc (cmp_optab, DFmode, "dpcmp"); + + /* GOFAST does not provide libfuncs for negation, so we use the + standard names. */ - The basic plan is to leave gcc proper alone and via some hook fix things - after the optabs have been set up. Our main entry point is - INIT_GOFAST_OPTABS. */ + /* GCC does not use fpcmp/dpcmp for gt or ge because its own + FP-emulation library returns +1 for both > and unord. So we + leave gt and ge unset, such that, instead of fpcmp(a,b) >[=], we + generate fpcmp(b,a) <[=] 0, which is unambiguous. For unord + libfuncs, we use our own functions, since GOFAST doesn't supply + them. */ -#define INIT_GOFAST_OPTABS \ - do { \ - GOFAST_CLEAR_NEG_FLOAT_OPTAB; \ - GOFAST_RENAME_LIBCALLS; \ - } while (0) + eqsf2_libfunc = init_one_libfunc ("fpcmp"); + nesf2_libfunc = init_one_libfunc ("fpcmp"); + gtsf2_libfunc = NULL_RTX; + gesf2_libfunc = NULL_RTX; + ltsf2_libfunc = init_one_libfunc ("fpcmp"); + lesf2_libfunc = init_one_libfunc ("fpcmp"); -#define GOFAST_CLEAR_NEG_FLOAT_OPTAB \ - do { \ - int mode; \ - for (mode = SFmode; (int) mode <= (int) TFmode; \ - mode = (enum machine_mode) ((int) mode + 1)) \ - neg_optab->handlers[(int) mode].libfunc = NULL_RTX; \ - } while (0) + eqdf2_libfunc = init_one_libfunc ("dpcmp"); + nedf2_libfunc = init_one_libfunc ("dpcmp"); + gtdf2_libfunc = NULL_RTX; + gedf2_libfunc = NULL_RTX; + ltdf2_libfunc = init_one_libfunc ("dpcmp"); + ledf2_libfunc = init_one_libfunc ("dpcmp"); -/* GCC does not use fpcmp/dpcmp for gt or ge because its own - FP-emulation library returns +1 for both > and unord. So we leave - gt and ge unset, such that, instead of fpcmp(a,b) >[=], we generate - fpcmp(b,a) <[=] 0, which is unambiguous. For unord libfuncs, we - use our own functions, since GOFAST doesn't supply them. */ -#define GOFAST_RENAME_LIBCALLS \ - add_optab->handlers[(int) SFmode].libfunc = init_one_libfunc ("fpadd"); \ - add_optab->handlers[(int) DFmode].libfunc = init_one_libfunc ("dpadd"); \ - sub_optab->handlers[(int) SFmode].libfunc = init_one_libfunc ("fpsub"); \ - sub_optab->handlers[(int) DFmode].libfunc = init_one_libfunc ("dpsub"); \ - smul_optab->handlers[(int) SFmode].libfunc = init_one_libfunc ("fpmul"); \ - smul_optab->handlers[(int) DFmode].libfunc = init_one_libfunc ("dpmul"); \ - sdiv_optab->handlers[(int) SFmode].libfunc = init_one_libfunc ("fpdiv"); \ - sdiv_optab->handlers[(int) DFmode].libfunc = init_one_libfunc ("dpdiv"); \ - cmp_optab->handlers[(int) SFmode].libfunc = init_one_libfunc ("fpcmp"); \ - cmp_optab->handlers[(int) DFmode].libfunc = init_one_libfunc ("dpcmp"); \ -\ - extendsfdf2_libfunc = init_one_libfunc ("fptodp"); \ - truncdfsf2_libfunc = init_one_libfunc ("dptofp"); \ -\ - eqhf2_libfunc = NULL_RTX; \ - nehf2_libfunc = NULL_RTX; \ - gthf2_libfunc = NULL_RTX; \ - gehf2_libfunc = NULL_RTX; \ - lthf2_libfunc = NULL_RTX; \ - lehf2_libfunc = NULL_RTX; \ -\ - eqsf2_libfunc = init_one_libfunc ("fpcmp"); \ - nesf2_libfunc = init_one_libfunc ("fpcmp"); \ - gtsf2_libfunc = NULL_RTX; \ - gesf2_libfunc = NULL_RTX; \ - ltsf2_libfunc = init_one_libfunc ("fpcmp"); \ - lesf2_libfunc = init_one_libfunc ("fpcmp"); \ -\ - eqdf2_libfunc = init_one_libfunc ("dpcmp"); \ - nedf2_libfunc = init_one_libfunc ("dpcmp"); \ - gtdf2_libfunc = NULL_RTX; \ - gedf2_libfunc = NULL_RTX; \ - ltdf2_libfunc = init_one_libfunc ("dpcmp"); \ - ledf2_libfunc = init_one_libfunc ("dpcmp"); \ -\ - eqxf2_libfunc = NULL_RTX; \ - nexf2_libfunc = NULL_RTX; \ - gtxf2_libfunc = NULL_RTX; \ - gexf2_libfunc = NULL_RTX; \ - ltxf2_libfunc = NULL_RTX; \ - lexf2_libfunc = NULL_RTX; \ -\ - eqtf2_libfunc = NULL_RTX; \ - netf2_libfunc = NULL_RTX; \ - gttf2_libfunc = NULL_RTX; \ - getf2_libfunc = NULL_RTX; \ - lttf2_libfunc = NULL_RTX; \ - letf2_libfunc = NULL_RTX; \ -\ - floatsisf_libfunc = init_one_libfunc ("sitofp"); \ - floatsidf_libfunc = init_one_libfunc ("litodp"); \ - fixsfsi_libfunc = init_one_libfunc ("fptosi"); \ - fixdfsi_libfunc = init_one_libfunc ("dptoli"); \ - fixunssfsi_libfunc = init_one_libfunc ("fptoui"); \ - fixunsdfsi_libfunc = init_one_libfunc ("dptoul"); \ + extendsfdf2_libfunc = init_one_libfunc ("fptodp"); + truncdfsf2_libfunc = init_one_libfunc ("dptofp"); -/* End of GOFAST_RENAME_LIBCALLS */ + floatsisf_libfunc = init_one_libfunc ("sitofp"); + floatsidf_libfunc = init_one_libfunc ("litodp"); + fixsfsi_libfunc = init_one_libfunc ("fptosi"); + fixdfsi_libfunc = init_one_libfunc ("dptoli"); + fixunssfsi_libfunc = init_one_libfunc ("fptoui"); + fixunsdfsi_libfunc = init_one_libfunc ("dptoul"); +#endif +} -- cgit v1.1