target.h (init_libfuncs): New hook.
authorZack Weinberg <zack@codesourcery.com>
Thu, 2 Oct 2003 00:44:29 +0000 (00:44 +0000)
committerZack Weinberg <zack@gcc.gnu.org>
Thu, 2 Oct 2003 00:44:29 +0000 (00:44 +0000)
* 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

56 files changed:
gcc/ChangeLog
gcc/Makefile.in
gcc/builtins.c
gcc/config.gcc
gcc/config/alpha/alpha.c
gcc/config/alpha/unicosmk.h
gcc/config/alpha/vms.h
gcc/config/avr/avr.c
gcc/config/avr/avr.h
gcc/config/c4x/c4x.c
gcc/config/c4x/c4x.h
gcc/config/cris/cris.c
gcc/config/cris/cris.h
gcc/config/frv/frv.c
gcc/config/frv/frv.h
gcc/config/gofast.h
gcc/config/h8300/h8300.c
gcc/config/h8300/h8300.h
gcc/config/i860/i860.c
gcc/config/i860/i860.h
gcc/config/ia64/hpux.h
gcc/config/ia64/hpux_longdouble.h [deleted file]
gcc/config/ia64/ia64.c
gcc/config/ip2k/ip2k.c
gcc/config/ip2k/ip2k.h
gcc/config/iq2000/iq2000.h
gcc/config/m68hc11/m68hc11.c
gcc/config/m68hc11/m68hc11.h
gcc/config/mips/mips.c
gcc/config/mips/mips.h
gcc/config/pa/long_double.h [deleted file]
gcc/config/pa/pa-hpux.h
gcc/config/pa/pa.c
gcc/config/rs6000/aix.h
gcc/config/rs6000/rs6000.c
gcc/config/rs6000/sysv4.h
gcc/config/rs6000/xcoff.h
gcc/config/sparc/elf.h
gcc/config/sparc/lite.h
gcc/config/sparc/liteelf.h
gcc/config/sparc/netbsd-elf.h
gcc/config/sparc/sol2.h
gcc/config/sparc/sp86x-elf.h
gcc/config/sparc/sparc.c
gcc/config/sparc/sparc.h
gcc/config/v850/v850.h
gcc/config/vax/elf.h
gcc/config/vax/vax.c
gcc/config/vax/vax.h
gcc/defaults.h
gcc/doc/tm.texi
gcc/expr.h
gcc/optabs.c
gcc/optabs.h
gcc/target-def.h
gcc/target.h

index ce865fe..367a269 100644 (file)
@@ -1,3 +1,77 @@
+2003-10-01  Zack Weinberg  <zack@codesourcery.com>
+
+       * 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.
+
 2003-10-01  Kelley Cook  <kelleycook@wideopenwest.com>
 
        PR C/12466
index 11f3857..3f1e0c9 100644 (file)
@@ -1564,7 +1564,8 @@ explow.o : explow.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_
    toplev.h function.h $(GGC_H) $(TM_P_H) gt-explow.h
 optabs.o : optabs.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \
    flags.h insn-config.h $(EXPR_H) $(OPTABS_H) libfuncs.h $(RECOG_H) reload.h \
-   toplev.h $(GGC_H) real.h $(TM_P_H) except.h gt-optabs.h $(BASIC_BLOCK_H)
+   toplev.h $(GGC_H) real.h $(TM_P_H) except.h gt-optabs.h $(BASIC_BLOCK_H) \
+   target.h
 dbxout.o : dbxout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(RTL_H) \
    flags.h $(REGS_H) debug.h $(TM_P_H) $(TARGET_H) function.h langhooks.h \
    insn-config.h reload.h gstab.h xcoffout.h output.h dbxout.h toplev.h \
index 5de1ac3..d7d7604 100644 (file)
@@ -6540,13 +6540,6 @@ validate_arglist (tree arglist, ...)
   return res;
 }
 
-/* Default version of target-specific builtin setup that does nothing.  */
-
-void
-default_init_builtins (void)
-{
-}
-
 /* Default target-specific builtin expander that does nothing.  */
 
 rtx
index 3ab7ef9..f58e854 100644 (file)
@@ -757,7 +757,7 @@ hppa1.1-*-bsd*)
        ;;
 hppa1.1-*-hpux10* | hppa2*-*-hpux10*)
        target_cpu_default="MASK_PA_11"
-       tm_file="${tm_file} pa/pa32-regs.h pa/long_double.h dbxelf.h pa/som.h pa/pa-hpux.h pa/pa-hpux10.h"
+       tm_file="${tm_file} pa/pa32-regs.h dbxelf.h pa/som.h pa/pa-hpux.h pa/pa-hpux10.h"
        tmake_file="pa/t-pa pa/t-pa-hpux pa/t-hpux-shlib"
        if test x$enable_threads = x; then
            enable_threads=$have_pthread_h
@@ -771,7 +771,7 @@ hppa1.1-*-hpux10* | hppa2*-*-hpux10*)
        use_fixproto=yes
        ;;
 hppa1.0-*-hpux10*)
-       tm_file="${tm_file} pa/pa32-regs.h pa/long_double.h dbxelf.h pa/som.h pa/pa-hpux.h pa/pa-hpux10.h"
+       tm_file="${tm_file} pa/pa32-regs.h dbxelf.h pa/som.h pa/pa-hpux.h pa/pa-hpux10.h"
        tmake_file="pa/t-pa pa/t-pa-hpux pa/t-hpux-shlib"
        if test x$enable_threads = x; then
            enable_threads=$have_pthread_h
@@ -788,11 +788,11 @@ hppa*64*-*-hpux11*)
        if test x$gas = xyes
        then
                tm_file="pa/pa64-start.h ${tm_file} dbxelf.h elfos.h  \
-                        pa/pa64-regs.h pa/long_double.h pa/pa-hpux.h \
+                        pa/pa64-regs.h pa/pa-hpux.h \
                         pa/pa-hpux11.h pa/pa-64.h pa/pa64-hpux.h"
        else
                tm_file="pa/pa64-start.h ${tm_file} dbxelf.h pa/elf.h \
-                        pa/pa64-regs.h pa/long_double.h pa/pa-hpux.h \
+                        pa/pa64-regs.h pa/pa-hpux.h \
                         pa/pa-hpux11.h pa/pa-64.h pa/pa64-hpux.h"
        fi
        need_64bit_hwint=yes
@@ -811,7 +811,7 @@ hppa*64*-*-hpux11*)
        ;;
 hppa1.1-*-hpux11* | hppa2*-*-hpux11*)
        target_cpu_default="MASK_PA_11"
-       tm_file="${tm_file} pa/pa32-regs.h pa/long_double.h dbxelf.h pa/som.h pa/pa-hpux.h pa/pa-hpux11.h"
+       tm_file="${tm_file} pa/pa32-regs.h dbxelf.h pa/som.h pa/pa-hpux.h pa/pa-hpux11.h"
        tmake_file="pa/t-pa pa/t-pa-hpux pa/t-hpux-shlib"
        case x${enable_threads} in
        xyes | xposix )
@@ -821,7 +821,7 @@ hppa1.1-*-hpux11* | hppa2*-*-hpux11*)
        use_collect2=yes
        ;;
 hppa1.0-*-hpux11*)
-       tm_file="${tm_file} pa/pa32-regs.h pa/long_double.h dbxelf.h pa/som.h pa/pa-hpux.h pa/pa-hpux11.h"
+       tm_file="${tm_file} pa/pa32-regs.h dbxelf.h pa/som.h pa/pa-hpux.h pa/pa-hpux11.h"
        tmake_file="pa/t-pa pa/t-pa-hpux pa/t-hpux-shlib"
        case x${enable_threads} in
        xyes | xposix )
@@ -1201,7 +1201,7 @@ ia64*-*-linux*)
        fi
        ;;
 ia64*-*-hpux*)
-       tm_file="${tm_file} dbxelf.h elfos.h svr4.h ia64/sysv4.h ia64/hpux.h ia64/hpux_longdouble.h"
+       tm_file="${tm_file} dbxelf.h elfos.h svr4.h ia64/sysv4.h ia64/hpux.h"
        tmake_file="ia64/t-ia64 ia64/t-hpux"
        target_cpu_default="MASK_GNU_AS"
        case x$enable_threads in
@@ -1978,17 +1978,17 @@ sparc-*-sysv4*)
        use_fixproto=yes
        ;;
 sparclite-*-coff*)
-       tm_file="${tm_file} gofast.h sparc/lite.h svr3.h sparc/litecoff.h dbxcoff.h libgloss.h"
+       tm_file="${tm_file} sparc/lite.h svr3.h sparc/litecoff.h dbxcoff.h libgloss.h"
        tmake_file=sparc/t-sparclite
        ;;
 sparclite-*-elf*)
-       tm_file="${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h sol2.h sparc/sol2.h sparc/elf.h gofast.h sparc/liteelf.h"
+       tm_file="${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h sol2.h sparc/sol2.h sparc/elf.h sparc/liteelf.h"
        tmake_file="sparc/t-sparclite sparc/t-crtfm"
         extra_parts="crtbegin.o crtend.o"
        use_fixproto=yes
        ;;
 sparc86x-*-elf*)
-       tm_file="${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h sol2.h sparc/sol2.h sparc/elf.h gofast.h sparc/sp86x-elf.h"
+       tm_file="${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h sol2.h sparc/sol2.h sparc/elf.h sparc/sp86x-elf.h"
        tmake_file="sparc/t-sp86x sparc/t-crtfm"
         extra_parts="crtbegin.o crtend.o"
        use_fixproto=yes
@@ -2576,8 +2576,7 @@ fi
                esac
                if test "x$enable_gofast" = xyes
                then
-                       tm_defines="INIT_SUBTARGET_OPTABS=INIT_GOFAST_OPTABS $tm_defines"
-                       tm_file="gofast.h $tm_file"
+                       tm_defines="US_SOFTWARE_GOFAST $tm_defines"
                        tmake_file="mips/t-gofast $tmake_file"
                else
                        tmake_file="mips/t-mips $tmake_file"
index ad6b619..2340358 100644 (file)
@@ -10015,6 +10015,35 @@ unicosmk_need_dex (rtx x ATTRIBUTE_UNUSED)
 
 #endif /* TARGET_ABI_UNICOSMK */
 
+static void
+alpha_init_libfuncs (void)
+{
+  if (TARGET_ABI_UNICOSMK)
+    {
+      /* Prevent gcc from generating calls to __divsi3.  */
+      set_optab_libfunc (sdiv_optab, SImode, 0);
+      set_optab_libfunc (udiv_optab, SImode, 0);
+
+      /* Use the functions provided by the system library
+        for DImode integer division.  */
+      set_optab_libfunc (sdiv_optab, DImode, "$sldiv");
+      set_optab_libfunc (udiv_optab, DImode, "$uldiv");
+    }
+  else if (TARGET_ABI_OPEN_VMS)
+    {
+      /* Use the VMS runtime library functions for division and
+        remainder.  */
+      set_optab_libfunc (sdiv_optab, SImode, "OTS$DIV_I");
+      set_optab_libfunc (sdiv_optab, DImode, "OTS$DIV_L");
+      set_optab_libfunc (udiv_optab, SImode, "OTS$DIV_UI");
+      set_optab_libfunc (udiv_optab, DImode, "OTS$DIV_UL");
+      set_optab_libfunc (smod_optab, SImode, "OTS$REM_I");
+      set_optab_libfunc (smod_optab, DImode, "OTS$REM_L");
+      set_optab_libfunc (umod_optab, SImode, "OTS$REM_UI");
+      set_optab_libfunc (umod_optab, DImode, "OTS$REM_UL");
+    }
+}
+
 \f
 /* Initialize the GCC target structure.  */
 #if TARGET_ABI_OPEN_VMS
@@ -10062,6 +10091,9 @@ unicosmk_need_dex (rtx x ATTRIBUTE_UNUSED)
 #undef TARGET_ASM_FUNCTION_END_PROLOGUE
 #define TARGET_ASM_FUNCTION_END_PROLOGUE alpha_output_function_end_prologue
 
+#undef TARGET_INIT_LIBFUNCS
+#define TARGET_INIT_LIBFUNCS alpha_init_libfuncs
+
 #if TARGET_ABI_UNICOSMK
 #undef TARGET_ASM_FILE_START
 #define TARGET_ASM_FILE_START unicosmk_file_start
index 5520bd5..a4789b0 100644 (file)
@@ -508,24 +508,6 @@ ssib_section ()                    \
 #undef DWARF2_DEBUGGING_INFO
 #undef DWARF2_UNWIND_INFO
 #undef INCOMING_RETURN_ADDR_RTX
-
-
-/* We use the functions provided by the system library for integer
-   division.  */
-
-#undef UDIVDI3_LIBCALL
-#undef DIVDI3_LIBCALL
-#define UDIVDI3_LIBCALL        "$uldiv"
-#define DIVDI3_LIBCALL "$sldiv"
-
-/* This is necessary to prevent gcc from generating calls to __divsi3.  */
-
-#define INIT_TARGET_OPTABS                                     \
-  do {                                                         \
-    sdiv_optab->handlers[(int) SImode].libfunc = NULL_RTX;     \
-    udiv_optab->handlers[(int) SImode].libfunc = NULL_RTX;     \
-  } while (0)
-
 #undef ASM_OUTPUT_SOURCE_LINE
 
 /* We don't need a start file.  */
index 7d10a1b..3bb9b59 100644 (file)
@@ -470,16 +470,6 @@ do {                                                                       \
 #undef LIB_SPEC
 #define LIB_SPEC "-lc"
 
-/* Define the names of the division and modulus functions.  */
-#define DIVSI3_LIBCALL "OTS$DIV_I"
-#define DIVDI3_LIBCALL "OTS$DIV_L"
-#define UDIVSI3_LIBCALL "OTS$DIV_UI"
-#define UDIVDI3_LIBCALL "OTS$DIV_UL"
-#define MODSI3_LIBCALL "OTS$REM_I"
-#define MODDI3_LIBCALL "OTS$REM_L"
-#define UMODSI3_LIBCALL "OTS$REM_UI"
-#define UMODDI3_LIBCALL "OTS$REM_UL"
-
 #define NAME__MAIN "__gccmain"
 #define SYMBOL__MAIN __gccmain
 
index b574ad2..9dd4daa 100644 (file)
@@ -276,7 +276,7 @@ avr_override_options ()
     avr_case_values_threshold = (!AVR_MEGA || TARGET_CALL_PROLOGUES) ? 8 : 17;
 }
 
-
+#if 0 /* Does not play nice with GC.  FIXME. */
 /* Initialize TMP_REG_RTX and ZERO_REG_RTX */
 void
 avr_init_once ()
@@ -296,6 +296,7 @@ avr_init_once ()
   PUT_MODE (ldi_reg_rtx, QImode);
   XINT (ldi_reg_rtx, 0) = LDI_REG_REGNO;
 }
+#endif
 
 /*  return register class from register number */
 
index dc4737d..735e75d 100644 (file)
@@ -2476,15 +2476,6 @@ extern int avr_case_values_threshold;
 #define OUT_AS2(a,b,c) output_asm_insn (AS2(a,b,c), operands)
 #define CR_TAB "\n\t"
 
-/* Define this macro as a C statement that declares additional library
-   routines renames existing ones. `init_optabs' calls this macro
-   after initializing all the normal library routines.  */
-
-#define INIT_TARGET_OPTABS                             \
-{                                                      \
-  avr_init_once ();                                    \
-}
-
 /* Temporary register r0 */
 #define TMP_REGNO 0
 
index 2d8a8b6..ef58602 100644 (file)
@@ -199,6 +199,7 @@ static int c4x_adjust_cost (rtx, rtx, rtx, int);
 static void c4x_globalize_label (FILE *, const char *);
 static bool c4x_rtx_costs (rtx, int, int, int *);
 static int c4x_address_cost (rtx);
+static void c4x_init_libfuncs (void);
 \f
 /* Initialize the GCC target structure.  */
 #undef TARGET_ASM_BYTE_OP
@@ -240,6 +241,9 @@ static int c4x_address_cost (rtx);
 #undef TARGET_MACHINE_DEPENDENT_REORG
 #define TARGET_MACHINE_DEPENDENT_REORG c4x_reorg
 
+#undef TARGET_INIT_LIBFUNCS
+#define TARGET_INIT_LIBFUNCS c4x_init_libfuncs
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
 /* Override command line options.
@@ -4839,6 +4843,35 @@ c4x_expand_builtin (tree exp, rtx target,
 }
 
 static void
+c4x_init_libfuncs (void)
+{
+  set_optab_libfunc (smul_optab, QImode, "__mulqi3");
+  set_optab_libfunc (sdiv_optab, QImode, "__divqi3");
+  set_optab_libfunc (udiv_optab, QImode, "__udivqi3");
+  set_optab_libfunc (smod_optab, QImode, "__modqi3");
+  set_optab_libfunc (umod_optab, QImode, "__umodqi3");
+  set_optab_libfunc (sdiv_optab, QFmode, "__divqf3");
+  set_optab_libfunc (smul_optab, HFmode, "__mulhf3");
+  set_optab_libfunc (sdiv_optab, HFmode, "__divhf3");
+  set_optab_libfunc (smul_optab, HImode, "__mulhi3");
+  set_optab_libfunc (sdiv_optab, HImode, "__divhi3");
+  set_optab_libfunc (udiv_optab, HImode, "__udivhi3");
+  set_optab_libfunc (smod_optab, HImode, "__modhi3");
+  set_optab_libfunc (umod_optab, HImode, "__umodhi3");
+  set_optab_libfunc (ffs_optab,  QImode, "__ffs");
+  smulhi3_libfunc           = init_one_libfunc ("__smulhi3_high");
+  umulhi3_libfunc           = init_one_libfunc ("__umulhi3_high");
+  fix_truncqfhi2_libfunc    = init_one_libfunc ("__fix_truncqfhi2");
+  fixuns_truncqfhi2_libfunc = init_one_libfunc ("__ufix_truncqfhi2");
+  fix_trunchfhi2_libfunc    = init_one_libfunc ("__fix_trunchfhi2");
+  fixuns_trunchfhi2_libfunc = init_one_libfunc ("__ufix_trunchfhi2");
+  floathiqf2_libfunc        = init_one_libfunc ("__floathiqf2");
+  floatunshiqf2_libfunc     = init_one_libfunc ("__ufloathiqf2");
+  floathihf2_libfunc        = init_one_libfunc ("__floathihf2");
+  floatunshihf2_libfunc     = init_one_libfunc ("__ufloathihf2");
+}
+
+static void
 c4x_asm_named_section (const char *name, unsigned int flags ATTRIBUTE_UNUSED)
 {
   fprintf (asm_out_file, "\t.sect\t\"%s\"\n", name);
index 5a59740..1988ce6 100644 (file)
@@ -1195,89 +1195,6 @@ CUMULATIVE_ARGS;
 
 /* Implicit Calls to Library Routines.  */
 
-#define MULQI3_LIBCALL      "__mulqi3"
-#define DIVQI3_LIBCALL      "__divqi3"
-#define UDIVQI3_LIBCALL     "__udivqi3"
-#define MODQI3_LIBCALL      "__modqi3"
-#define UMODQI3_LIBCALL     "__umodqi3"
-
-#define DIVQF3_LIBCALL      "__divqf3"
-
-#define MULHF3_LIBCALL      "__mulhf3"
-#define DIVHF3_LIBCALL      "__divhf3"
-
-#define MULHI3_LIBCALL      "__mulhi3"
-#define SMULHI3_LIBCALL     "__smulhi3_high"
-#define UMULHI3_LIBCALL     "__umulhi3_high"
-#define DIVHI3_LIBCALL      "__divhi3"
-#define UDIVHI3_LIBCALL     "__udivhi3"
-#define MODHI3_LIBCALL      "__modhi3"
-#define UMODHI3_LIBCALL     "__umodhi3"
-
-#define FLOATHIQF2_LIBCALL  "__floathiqf2"
-#define FLOATUNSHIQF2_LIBCALL  "__ufloathiqf2"
-#define FIX_TRUNCQFHI2_LIBCALL "__fix_truncqfhi2"
-#define FIXUNS_TRUNCQFHI2_LIBCALL "__ufix_truncqfhi2"
-
-#define FLOATHIHF2_LIBCALL  "__floathihf2"
-#define FLOATUNSHIHF2_LIBCALL  "__ufloathihf2"
-#define FIX_TRUNCHFHI2_LIBCALL "__fix_trunchfhi2"
-#define FIXUNS_TRUNCHFHI2_LIBCALL "__ufix_trunchfhi2"
-
-#define FFS_LIBCALL        "__ffs"
-
-#define INIT_TARGET_OPTABS \
-  do { \
-    smul_optab->handlers[(int) QImode].libfunc         \
-      = init_one_libfunc (MULQI3_LIBCALL);             \
-    sdiv_optab->handlers[(int) QImode].libfunc         \
-      = init_one_libfunc (DIVQI3_LIBCALL);             \
-    udiv_optab->handlers[(int) QImode].libfunc         \
-      = init_one_libfunc (UDIVQI3_LIBCALL);            \
-    smod_optab->handlers[(int) QImode].libfunc         \
-      = init_one_libfunc (MODQI3_LIBCALL);             \
-    umod_optab->handlers[(int) QImode].libfunc         \
-      = init_one_libfunc (UMODQI3_LIBCALL);            \
-    sdiv_optab->handlers[(int) QFmode].libfunc         \
-      = init_one_libfunc (DIVQF3_LIBCALL);             \
-    smul_optab->handlers[(int) HFmode].libfunc         \
-      = init_one_libfunc (MULHF3_LIBCALL);             \
-    sdiv_optab->handlers[(int) HFmode].libfunc         \
-      = init_one_libfunc (DIVHF3_LIBCALL);             \
-    smul_optab->handlers[(int) HImode].libfunc         \
-      = init_one_libfunc (MULHI3_LIBCALL);             \
-    sdiv_optab->handlers[(int) HImode].libfunc         \
-      = init_one_libfunc (DIVHI3_LIBCALL);             \
-    udiv_optab->handlers[(int) HImode].libfunc         \
-      = init_one_libfunc (UDIVHI3_LIBCALL);            \
-    smod_optab->handlers[(int) HImode].libfunc         \
-      = init_one_libfunc (MODHI3_LIBCALL);             \
-    umod_optab->handlers[(int) HImode].libfunc         \
-      = init_one_libfunc (UMODHI3_LIBCALL);            \
-    ffs_optab->handlers[(int) QImode].libfunc          \
-      = init_one_libfunc (FFS_LIBCALL);                        \
-    smulhi3_libfunc                                    \
-      = init_one_libfunc(SMULHI3_LIBCALL);             \
-    umulhi3_libfunc                                    \
-      = init_one_libfunc(UMULHI3_LIBCALL);             \
-    fix_truncqfhi2_libfunc                             \
-      = init_one_libfunc(FIX_TRUNCQFHI2_LIBCALL);      \
-    fixuns_truncqfhi2_libfunc                          \
-      = init_one_libfunc(FIXUNS_TRUNCQFHI2_LIBCALL);   \
-    fix_trunchfhi2_libfunc                             \
-      = init_one_libfunc(FIX_TRUNCHFHI2_LIBCALL);      \
-    fixuns_trunchfhi2_libfunc                          \
-      = init_one_libfunc(FIXUNS_TRUNCHFHI2_LIBCALL);   \
-    floathiqf2_libfunc                                 \
-      = init_one_libfunc(FLOATHIQF2_LIBCALL);          \
-    floatunshiqf2_libfunc                              \
-      = init_one_libfunc(FLOATUNSHIQF2_LIBCALL);       \
-    floathihf2_libfunc                                 \
-      = init_one_libfunc(FLOATHIHF2_LIBCALL);          \
-    floatunshihf2_libfunc                              \
-      = init_one_libfunc(FLOATUNSHIHF2_LIBCALL);       \
-  } while (0)
-
 #define TARGET_MEM_FUNCTIONS
 
 /* CC_NOOVmode should be used when the first operand is a PLUS, MINUS, NEG
index b4c064c..9213b1e 100644 (file)
@@ -43,6 +43,7 @@ Boston, MA 02111-1307, USA.  */
 #include "target.h"
 #include "target-def.h"
 #include "ggc.h"
+#include "optabs.h"
 
 /* Usable when we have an amount to add or subtract, and want the
    optimal size of the insn.  */
@@ -104,6 +105,7 @@ static void cris_asm_output_mi_thunk
   (FILE *, tree, HOST_WIDE_INT, HOST_WIDE_INT, tree);
 
 static void cris_file_start (void);
+static void cris_init_libfuncs (void);
 
 static bool cris_rtx_costs (rtx, int, int, int *);
 static int cris_address_cost (rtx);
@@ -165,6 +167,9 @@ int cris_cpu_version = CRIS_DEFAULT_CPU_VERSION;
 #undef TARGET_ASM_FILE_START
 #define TARGET_ASM_FILE_START cris_file_start
 
+#undef TARGET_INIT_LIBFUNCS
+#define TARGET_INIT_LIBFUNCS cris_init_libfuncs
+
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS cris_rtx_costs
 #undef TARGET_ADDRESS_COST
@@ -2720,6 +2725,17 @@ cris_file_start (void)
   default_file_start ();
 }
 
+/* Rename the function calls for integer multiply and divide.  */
+static void
+cris_init_libfuncs ()
+{
+  set_optab_libfunc (smul_optab, SImode, "__Mul");
+  set_optab_libfunc (sdiv_optab, SImode, "__Div");
+  set_optab_libfunc (udiv_optab, SImode, "__Udiv");
+  set_optab_libfunc (smod_optab, SImode, "__Mod");
+  set_optab_libfunc (umod_optab, SImode, "__Umod");
+}
+
 /* The EXPAND_BUILTIN_VA_ARG worker.  This is modified from the
    "standard" implementation of va_arg: read the value from the current
    address and increment by the size of one or two registers.  The
index 7995308..0dc57f4 100644 (file)
@@ -1097,12 +1097,6 @@ struct cum_args {int regs;};
 
 /* Node: Library Calls */
 
-#define MULSI3_LIBCALL "__Mul"
-#define DIVSI3_LIBCALL "__Div"
-#define UDIVSI3_LIBCALL "__Udiv"
-#define MODSI3_LIBCALL "__Mod"
-#define UMODSI3_LIBCALL "__Umod"
-
 /* If you change this, you have to check whatever libraries and systems
    that use it.  */
 #define TARGET_EDOM 33
index ddfec4e..09d6d97 100644 (file)
@@ -40,6 +40,7 @@ Boston, MA 02111-1307, USA.  */
 #include "except.h"
 #include "function.h"
 #include "optabs.h"
+#include "libfuncs.h"
 #include "toplev.h"
 #include "basic-block.h"
 #include "tm_p.h"
@@ -277,6 +278,7 @@ static void frv_function_epilogue           PARAMS ((FILE *, HOST_WIDE_INT));
 static bool frv_assemble_integer               PARAMS ((rtx, unsigned, int));
 static void frv_init_builtins                  PARAMS ((void));
 static rtx frv_expand_builtin                  PARAMS ((tree, rtx, rtx, enum machine_mode, int));
+static void frv_init_libfuncs                  PARAMS ((void));
 static bool frv_in_small_data_p                        PARAMS ((tree));
 static void frv_asm_output_mi_thunk
   PARAMS ((FILE *, tree, HOST_WIDE_INT, HOST_WIDE_INT, tree));
@@ -295,6 +297,8 @@ static void frv_asm_out_destructor          PARAMS ((rtx, int));
 #define TARGET_INIT_BUILTINS frv_init_builtins
 #undef TARGET_EXPAND_BUILTIN
 #define TARGET_EXPAND_BUILTIN frv_expand_builtin
+#undef TARGET_INIT_LIBFUNCS
+#define TARGET_INIT_LIBFUNCS frv_init_libfuncs
 #undef TARGET_IN_SMALL_DATA_P
 #define TARGET_IN_SMALL_DATA_P frv_in_small_data_p
 #undef TARGET_RTX_COSTS
@@ -9083,6 +9087,51 @@ frv_init_builtins ()
 #undef TRINARY
 }
 
+/* Set the names for various arithmetic operations according to the
+   FRV ABI.  */
+static void
+frv_init_libfuncs (void)
+{
+  set_optab_libfunc (smod_optab,     SImode, "__modi");
+  set_optab_libfunc (umod_optab,     SImode, "__umodi");
+
+  set_optab_libfunc (add_optab,      DImode, "__addll");
+  set_optab_libfunc (sub_optab,      DImode, "__subll");
+  set_optab_libfunc (smul_optab,     DImode, "__mulll");
+  set_optab_libfunc (sdiv_optab,     DImode, "__divll");
+  set_optab_libfunc (smod_optab,     DImode, "__modll");
+  set_optab_libfunc (umod_optab,     DImode, "__umodll");
+  set_optab_libfunc (and_optab,      DImode, "__andll");
+  set_optab_libfunc (ior_optab,      DImode, "__orll");
+  set_optab_libfunc (xor_optab,      DImode, "__xorll");
+  set_optab_libfunc (one_cmpl_optab, DImode, "__notll");
+
+  set_optab_libfunc (add_optab,      SFmode, "__addf");
+  set_optab_libfunc (sub_optab,      SFmode, "__subf");
+  set_optab_libfunc (smul_optab,     SFmode, "__mulf");
+  set_optab_libfunc (sdiv_optab,     SFmode, "__divf");
+
+  set_optab_libfunc (add_optab,      DFmode, "__addd");
+  set_optab_libfunc (sub_optab,      DFmode, "__subd");
+  set_optab_libfunc (smul_optab,     DFmode, "__muld");
+  set_optab_libfunc (sdiv_optab,     DFmode, "__divd");
+
+  fixsfsi_libfunc     = init_one_libfunc ("__ftoi");
+  fixunssfsi_libfunc  = init_one_libfunc ("__ftoui");
+  fixsfdi_libfunc     = init_one_libfunc ("__ftoll");
+  fixunssfdi_libfunc  = init_one_libfunc ("__ftoull");
+  fixdfsi_libfunc     = init_one_libfunc ("__dtoi");
+  fixunsdfsi_libfunc  = init_one_libfunc ("__dtoui");
+  fixdfdi_libfunc     = init_one_libfunc ("__dtoll");
+  fixunsdfdi_libfunc  = init_one_libfunc ("__dtoull");
+  floatsisf_libfunc   = init_one_libfunc ("__itof");
+  floatdisf_libfunc   = init_one_libfunc ("__lltof");
+  floatsidf_libfunc   = init_one_libfunc ("__itod");
+  floatdidf_libfunc   = init_one_libfunc ("__lltod");
+  extendsfdf2_libfunc = init_one_libfunc ("__ftod");
+  truncdfsf2_libfunc  = init_one_libfunc ("__dtof");
+}
+
 /* Convert an integer constant to an accumulator register.  ICODE is the
    code of the target instruction, OPNUM is the number of the
    accumulator operand and OPVAL is the constant integer.  Try both
index c820cfd..cd8019f 100644 (file)
@@ -2224,101 +2224,6 @@ __asm__("\n"                                                            \
        "\tjmpl @(gr0,gr6)\n");
 
 \f
-/* Implicit Calls to Library Routines.  */
-
-/* A C string constant giving the name of the function to call for the
-   remainder in division of one signed full-word by another.  If you do not
-   define this macro, the default name is used, which is `__modsi3', a function
-   defined in `libgcc.a'.  */
-#define MODSI3_LIBCALL "__modi"
-
-/* A C string constant giving the name of the function to call for the
-   remainder in division of one unsigned full-word by another.  If you do not
-   define this macro, the default name is used, which is `__umodsi3', a
-   function defined in `libgcc.a'.  */
-#define UMODSI3_LIBCALL "__umodi"
-
-/* A C string constant giving the name of the function to call for
-   multiplication of one signed double-word by another.  If you do not define
-   this macro, the default name is used, which is `__muldi3', a function
-   defined in `libgcc.a'.  */
-#define MULDI3_LIBCALL "__mulll"
-
-/* A C string constant giving the name of the function to call for division of
-   one signed double-word by another.  If you do not define this macro, the
-   default name is used, which is `__divdi3', a function defined in `libgcc.a'.  */
-#define DIVDI3_LIBCALL "__divll"
-
-/* A C string constant giving the name of the function to call for division of
-   one unsigned full-word by another.  If you do not define this macro, the
-   default name is used, which is `__udivdi3', a function defined in
-   `libgcc.a'.  */
-#define UDIVDI3_LIBCALL "__udivll"
-
-/* A C string constant giving the name of the function to call for the
-   remainder in division of one signed double-word by another.  If you do not
-   define this macro, the default name is used, which is `__moddi3', a function
-   defined in `libgcc.a'.  */
-#define MODDI3_LIBCALL "__modll"
-
-/* A C string constant giving the name of the function to call for the
-   remainder in division of one unsigned full-word by another.  If you do not
-   define this macro, the default name is used, which is `__umoddi3', a
-   function defined in `libgcc.a'.  */
-#define UMODDI3_LIBCALL "__umodll"
-
-/* Define this macro as a C statement that declares additional library routines
-   renames existing ones. `init_optabs' calls this macro after initializing all
-   the normal library routines.  */
-#define INIT_TARGET_OPTABS                                     \
-  do                                                           \
-    {                                                          \
-      add_optab->handlers [(int) DImode].libfunc               \
-       = init_one_libfunc ("__addll");                         \
-      sub_optab->handlers [(int) DImode].libfunc               \
-       = init_one_libfunc ("__subll");                         \
-      and_optab->handlers [(int) DImode].libfunc               \
-       = init_one_libfunc ("__andll");                         \
-      ior_optab->handlers [(int) DImode].libfunc               \
-       = init_one_libfunc ("__orll");                          \
-      xor_optab->handlers [(int) DImode].libfunc               \
-       = init_one_libfunc ("__xorll");                         \
-      one_cmpl_optab->handlers [(int) DImode].libfunc          \
-       = init_one_libfunc ("__notll");                         \
-      add_optab->handlers [(int) SFmode].libfunc               \
-       = init_one_libfunc ("__addf");                          \
-      sub_optab->handlers [(int) SFmode].libfunc               \
-       = init_one_libfunc ("__subf");                          \
-      smul_optab->handlers [(int) SFmode].libfunc              \
-       = init_one_libfunc ("__mulf");                          \
-      sdiv_optab->handlers [(int) SFmode].libfunc              \
-       = init_one_libfunc ("__divf");                          \
-      add_optab->handlers [(int) DFmode].libfunc               \
-       = init_one_libfunc ("__addd");                          \
-      sub_optab->handlers [(int) DFmode].libfunc               \
-       = init_one_libfunc ("__subd");                          \
-      smul_optab->handlers [(int) DFmode].libfunc              \
-       = init_one_libfunc ("__muld");                          \
-      sdiv_optab->handlers [(int) DFmode].libfunc              \
-       = init_one_libfunc ("__divd");                          \
-      fixsfsi_libfunc = init_one_libfunc ("__ftoi");           \
-      fixunssfsi_libfunc = init_one_libfunc ("__ftoui");       \
-      fixsfdi_libfunc = init_one_libfunc ("__ftoll");          \
-      fixunssfdi_libfunc = init_one_libfunc ("__ftoull");      \
-      fixdfsi_libfunc = init_one_libfunc ("__dtoi");           \
-      fixunsdfsi_libfunc = init_one_libfunc ("__dtoui");       \
-      fixdfdi_libfunc = init_one_libfunc ("__dtoll");          \
-      fixunsdfdi_libfunc = init_one_libfunc ("__dtoull");      \
-      floatsisf_libfunc = init_one_libfunc ("__itof");         \
-      floatdisf_libfunc = init_one_libfunc ("__lltof");                \
-      floatsidf_libfunc = init_one_libfunc ("__itod");         \
-      floatdidf_libfunc = init_one_libfunc ("__lltod");                \
-      extendsfdf2_libfunc = init_one_libfunc ("__ftod");       \
-      truncdfsf2_libfunc = init_one_libfunc ("__dtof");                \
-    }                                                          \
-  while (0)
-
-\f
 /* Addressing Modes.  */
 
 /* A C expression that is 1 if the RTX X is a constant which is a valid
index 3af267c..74a22c7 100644 (file)
@@ -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
+}
index 3d874c2..5f21a0a 100644 (file)
@@ -38,6 +38,7 @@ Boston, MA 02111-1307, USA.  */
 #include "recog.h"
 #include "expr.h"
 #include "function.h"
+#include "optabs.h"
 #include "toplev.h"
 #include "c-pragma.h"
 #include "tm_p.h"
@@ -4507,6 +4508,17 @@ h8300_hard_regno_rename_ok (unsigned int old_reg ATTRIBUTE_UNUSED,
    return 1;
 }
 \f
+/* Perform target dependent optabs initialization.  */
+static void
+h8300_init_libfuncs (void)
+{
+  set_optab_libfunc (smul_optab, HImode, "__mulhi3");
+  set_optab_libfunc (sdiv_optab, HImode, "__divhi3");
+  set_optab_libfunc (udiv_optab, HImode, "__udivhi3");
+  set_optab_libfunc (smod_optab, HImode, "__modhi3");
+  set_optab_libfunc (umod_optab, HImode, "__umodhi3");
+}
+\f
 /* Initialize the GCC target structure.  */
 #undef TARGET_ATTRIBUTE_TABLE
 #define TARGET_ATTRIBUTE_TABLE h8300_attribute_table
@@ -4534,4 +4546,7 @@ h8300_hard_regno_rename_ok (unsigned int old_reg ATTRIBUTE_UNUSED,
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS h8300_rtx_costs
 
+#undef TARGET_INIT_LIBFUNCS
+#define TARGET_INIT_LIBFUNCS h8300_init_libfuncs
+
 struct gcc_target targetm = TARGET_INITIALIZER;
index c4103d0..b31bdf5 100644 (file)
@@ -1197,30 +1197,6 @@ struct cum_arg
 
 #define TARGET_MEM_FUNCTIONS
 
-#define MULHI3_LIBCALL "__mulhi3"
-#define DIVHI3_LIBCALL "__divhi3"
-#define UDIVHI3_LIBCALL        "__udivhi3"
-#define MODHI3_LIBCALL "__modhi3"
-#define UMODHI3_LIBCALL        "__umodhi3"
-
-/* Perform target dependent optabs initialization.  */
-
-#define INIT_TARGET_OPTABS                                     \
-  do                                                           \
-    {                                                          \
-      smul_optab->handlers[(int) HImode].libfunc               \
-       = init_one_libfunc (MULHI3_LIBCALL);                    \
-      sdiv_optab->handlers[(int) HImode].libfunc               \
-       = init_one_libfunc (DIVHI3_LIBCALL);                    \
-      udiv_optab->handlers[(int) HImode].libfunc               \
-       = init_one_libfunc (UDIVHI3_LIBCALL);                   \
-      smod_optab->handlers[(int) HImode].libfunc               \
-       = init_one_libfunc (MODHI3_LIBCALL);                    \
-      umod_optab->handlers[(int) HImode].libfunc               \
-       = init_one_libfunc (UMODHI3_LIBCALL);                   \
-    }                                                          \
-  while (0)
-
 #define MOVE_RATIO 3
 
 /* Define the codes that are matched by predicates in h8300.c.  */
index f56de28..a8585ef 100644 (file)
@@ -43,6 +43,7 @@ Boston, MA 02111-1307, USA.  */
 #include "insn-attr.h"
 #include "function.h"
 #include "expr.h"
+#include "optabs.h"
 #include "toplev.h"
 #include "tm_p.h"
 #include "target.h"
@@ -2091,6 +2092,14 @@ i860_file_start (void)
   fprintf (asm_out_file, "\t.version\t\"01.01\"\n");
 }
 
+static void
+i860_init_libfuncs (void)
+{
+  set_optab_libfunc (sdiv_optab, SImode, "*.div");
+  set_optab_libfunc (udiv_optab, SImode, "*.udiv");
+  set_optab_libfunc (smod_optab, SImode, "*.rem");
+  set_optab_libfunc (umod_optab, SImode, "*.urem");
+}
 
 /* Initialize the GCC target structure.  */
 #undef TARGET_RTX_COSTS
@@ -2105,5 +2114,8 @@ i860_file_start (void)
 #undef TARGET_ASM_FUNCTION_EPILOGUE
 #define TARGET_ASM_FUNCTION_EPILOGUE i860_output_function_epilogue
 
+#undef TARGET_INIT_LIBFUNCS
+#define TARGET_INIT_LIBFUNCS i860_init_libfuncs
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
index f5ce0b1..11aa529 100644 (file)
@@ -835,11 +835,6 @@ struct cumulative_args { int ints, floats; };
    Do not define this if the table should contain absolute addresses. */
 /* #define CASE_VECTOR_PC_RELATIVE 1 */
 
-#define DIVSI3_LIBCALL "*.div"
-#define UDIVSI3_LIBCALL "*.udiv"
-#define MODSI3_LIBCALL "*.rem"
-#define UMODSI3_LIBCALL "*.urem"
-
 /* Define this as 1 if `char' should by default be signed; else as 0.  */
 #define DEFAULT_SIGNED_CHAR 1
 
index b2b854b..be2470c 100644 (file)
@@ -187,3 +187,10 @@ do {                                                               \
 #undef TARGET_C99_FUNCTIONS
 #define TARGET_C99_FUNCTIONS  1
 
+/* We are using IEEE quad precision, not a double-extended with padding.  */
+#undef INTEL_EXTENDED_IEEE_FORMAT
+#define INTEL_EXTENDED_IEEE_FORMAT 0
+
+#define TARGET_INIT_LIBFUNCS ia64_hpux_init_libfuncs
+
+#define FLOAT_LIB_COMPARE_RETURNS_BOOL(MODE, COMPARISON) ((MODE) == TFmode)
diff --git a/gcc/config/ia64/hpux_longdouble.h b/gcc/config/ia64/hpux_longdouble.h
deleted file mode 100644 (file)
index ec704bd..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-/* Definitions of long double support for GNU compiler.
-   Copyright (C) 2000, 2001 Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GCC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-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.  */
-
-/* We are using IEEE quad precision, not a double-extended with padding.  */
-#undef INTEL_EXTENDED_IEEE_FORMAT
-#define INTEL_EXTENDED_IEEE_FORMAT 0
-
-/* Define library calls for quad FP operations.  These are all part of the
-   IA32 and IA64 ABIs.  */
-
-#define ADDTF3_LIBCALL "_U_Qfadd"
-#define SUBTF3_LIBCALL "_U_Qfsub"
-#define MULTF3_LIBCALL "_U_Qfmpy"
-#define DIVTF3_LIBCALL "_U_Qfdiv"
-#define NEGTF2_LIBCALL "_U_Qfneg"
-#define ABSTF2_LIBCALL "_U_Qfabs"
-#define SMINTF3_LIBCALL "_U_Qfmin"
-#define SMAXTF3_LIBCALL "_U_Qfmax"
-#define EXTENDSFTF2_LIBCALL "_U_Qfcnvff_sgl_to_quad"
-#define EXTENDDFTF2_LIBCALL "_U_Qfcnvff_dbl_to_quad"
-#define TRUNCTFSF2_LIBCALL "_U_Qfcnvff_quad_to_sgl"
-#define TRUNCTFDF2_LIBCALL "_U_Qfcnvff_quad_to_dbl"
-#define FLOATSITF2_LIBCALL "_U_Qfcnvxf_sgl_to_quad"
-#define FLOATDITF2_LIBCALL "_U_Qfcnvxf_dbl_to_quad"
-#define FIX_TRUNCTFSI2_LIBCALL "_U_Qfcnvfxt_quad_to_sgl"
-#define FIX_TRUNCTFDI2_LIBCALL "_U_Qfcnvfxt_quad_to_dbl"
-#define FIXUNS_TRUNCTFSI2_LIBCALL "_U_Qfcnvfxut_quad_to_sgl"
-#define FIXUNS_TRUNCTFDI2_LIBCALL "_U_Qfcnvfxut_quad_to_dbl"
-#define EQTF2_LIBCALL "_U_Qfeq"
-#define NETF2_LIBCALL "_U_Qfne"
-#define GTTF2_LIBCALL "_U_Qfgt"
-#define GETF2_LIBCALL "_U_Qfge"
-#define LTTF2_LIBCALL "_U_Qflt"
-#define LETF2_LIBCALL "_U_Qfle"
-
-
-#undef INIT_TARGET_OPTABS
-#define INIT_TARGET_OPTABS                                             \
-  do {                                                                 \
-    add_optab->handlers[(int) TFmode].libfunc                          \
-      = gen_rtx_SYMBOL_REF (Pmode, ADDTF3_LIBCALL);                    \
-    sub_optab->handlers[(int) TFmode].libfunc                          \
-      = gen_rtx_SYMBOL_REF (Pmode, SUBTF3_LIBCALL);                    \
-    smul_optab->handlers[(int) TFmode].libfunc                         \
-      = gen_rtx_SYMBOL_REF (Pmode, MULTF3_LIBCALL);                    \
-    sdiv_optab->handlers[(int) TFmode].libfunc                         \
-      = gen_rtx_SYMBOL_REF (Pmode, DIVTF3_LIBCALL);                    \
-    smin_optab->handlers[(int) TFmode].libfunc                         \
-      = gen_rtx_SYMBOL_REF (Pmode, SMINTF3_LIBCALL);                   \
-    smax_optab->handlers[(int) TFmode].libfunc                         \
-      = gen_rtx_SYMBOL_REF (Pmode, SMAXTF3_LIBCALL);                   \
-    abs_optab->handlers[(int) TFmode].libfunc                          \
-      = gen_rtx_SYMBOL_REF (Pmode, ABSTF2_LIBCALL);                    \
-    neg_optab->handlers[(int) TFmode].libfunc                          \
-      = gen_rtx_SYMBOL_REF (Pmode, NEGTF2_LIBCALL);                    \
-    extendsftf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, EXTENDSFTF2_LIBCALL); \
-    extenddftf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, EXTENDDFTF2_LIBCALL); \
-    trunctfsf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, TRUNCTFSF2_LIBCALL); \
-    trunctfdf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, TRUNCTFDF2_LIBCALL); \
-    floatsitf_libfunc = gen_rtx_SYMBOL_REF (Pmode, FLOATSITF2_LIBCALL);  \
-    floatditf_libfunc = gen_rtx_SYMBOL_REF (Pmode, FLOATDITF2_LIBCALL);  \
-    fixtfsi_libfunc = gen_rtx_SYMBOL_REF (Pmode, FIX_TRUNCTFSI2_LIBCALL);\
-    fixtfdi_libfunc = gen_rtx_SYMBOL_REF (Pmode, FIX_TRUNCTFDI2_LIBCALL);\
-    fixunstfsi_libfunc = gen_rtx_SYMBOL_REF (Pmode, FIXUNS_TRUNCTFSI2_LIBCALL);  \
-    fixunstfdi_libfunc = gen_rtx_SYMBOL_REF (Pmode, FIXUNS_TRUNCTFDI2_LIBCALL);  \
-    eqtf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, EQTF2_LIBCALL);         \
-    netf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, NETF2_LIBCALL);         \
-    gttf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, GTTF2_LIBCALL);         \
-    getf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, GETF2_LIBCALL);         \
-    lttf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, LTTF2_LIBCALL);         \
-    letf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, LETF2_LIBCALL);         \
-                                                                       \
-    INIT_SUBTARGET_OPTABS;                                             \
-  } while (0)
-
-/* This is meant to be redefined in the host dependent files */
-#define INIT_SUBTARGET_OPTABS
-
-/* Nonzero if a floating point comparison library call for
-   mode MODE that will return a boolean value.  Zero if one
-   of the libgcc2 functions is used.  */
-#define FLOAT_LIB_COMPARE_RETURNS_BOOL(MODE, COMPARISON) ((MODE) == TFmode)
index f82981b..1633a58 100644 (file)
@@ -37,6 +37,7 @@ Boston, MA 02111-1307, USA.  */
 #include "recog.h"
 #include "expr.h"
 #include "optabs.h"
+#include "libfuncs.h"
 #include "except.h"
 #include "function.h"
 #include "ggc.h"
@@ -253,6 +254,8 @@ static void ia64_hpux_add_extern_decl (const char *name)
      ATTRIBUTE_UNUSED;
 static void ia64_hpux_file_end (void)
      ATTRIBUTE_UNUSED;
+static void ia64_hpux_init_libfuncs (void)
+     ATTRIBUTE_UNUSED;
 
 static tree ia64_handle_model_attribute (tree *, tree, tree, int, bool *);
 static void ia64_encode_section_info (tree, rtx, int);
@@ -8304,6 +8307,36 @@ ia64_hpux_file_end (void)
     }
 }
 
+/* Rename all the TFmode libfuncs using the HPUX conventions.  */
+static void
+ia64_hpux_init_libfuncs (void)
+{
+  set_optab_libfunc (add_optab, TFmode, "_U_Qfadd");
+  set_optab_libfunc (sub_optab, TFmode, "_U_Qfsub");
+  set_optab_libfunc (smul_optab, TFmode, "_Q_Qfmpy");
+  set_optab_libfunc (sdiv_optab, TFmode, "_U_Qfdiv");
+  set_optab_libfunc (smin_optab, TFmode, "_U_Qfmin");
+  set_optab_libfunc (smax_optab, TFmode, "_U_Qfmax");
+  set_optab_libfunc (abs_optab, TFmode, "_U_Qfabs");
+  set_optab_libfunc (neg_optab, TFmode, "_U_Qfneg");
+
+  extendsftf2_libfunc = init_one_libfunc ("_U_Qfcnvff_sgl_to_quad");
+  extenddftf2_libfunc = init_one_libfunc ("_U_Qfcnvff_dbl_to_quad");
+  trunctfsf2_libfunc = init_one_libfunc ("_U_Qfcnvff_quad_to_sgl");
+  trunctfdf2_libfunc = init_one_libfunc ("_U_Qfcnvff_quad_to_dbl");
+  floatsitf_libfunc = init_one_libfunc ("_U_Qfcnvxf_sgl_to_quad");
+  floatditf_libfunc = init_one_libfunc ("_U_Qfcnvxf_dbl_to_quad");
+  fixtfsi_libfunc = init_one_libfunc ("_U_Qfcnvfxt_quad_to_sgl");
+  fixtfdi_libfunc = init_one_libfunc ("_U_Qfcnvfxt_quad_to_dbl");
+  fixunstfsi_libfunc = init_one_libfunc ("_U_Qfcnvfxut_quad_to_sgl");
+  fixunstfdi_libfunc = init_one_libfunc ("_U_Qfcnvfxut_quad_to_dbl");
+  eqtf2_libfunc = init_one_libfunc ("_U_Qfeq");
+  netf2_libfunc = init_one_libfunc ("_U_Qfne");
+  gttf2_libfunc = init_one_libfunc ("_U_Qfgt");
+  getf2_libfunc = init_one_libfunc ("_U_Qfge");
+  lttf2_libfunc = init_one_libfunc ("_U_Qflt");
+  letf2_libfunc = init_one_libfunc ("_U_Qfle");
+}
 \f
 /* Switch to the section to which we should output X.  The only thing
    special we do here is to honor small data.  */
index aecb744..e31347f 100644 (file)
@@ -38,6 +38,7 @@
 #include "reload.h"
 #include "tree.h"
 #include "expr.h"
+#include "optabs.h"
 #include "toplev.h"
 #include "obstack.h"
 #include "function.h"
@@ -81,6 +82,7 @@ static tree ip2k_handle_fndecl_attribute PARAMS ((tree *, tree, tree, int,
                                                  bool *));
 static bool ip2k_rtx_costs PARAMS ((rtx, int, int, int *));
 static int ip2k_address_cost PARAMS ((rtx));
+static void ip2k_init_libfuncs PARAMS ((void));
 
 const struct attribute_spec ip2k_attribute_table[];
 
@@ -109,6 +111,9 @@ const struct attribute_spec ip2k_attribute_table[];
 #undef TARGET_MACHINE_DEPENDENT_REORG
 #define TARGET_MACHINE_DEPENDENT_REORG ip2k_reorg
 
+#undef TARGET_INIT_LIBFUNCS
+#define TARGET_INIT_LIBFUNCS ip2k_init_libfuncs
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 /* Prologue/Epilogue size in words.  */
@@ -5503,6 +5508,15 @@ ip2k_reorg ()
 #endif
 }
 
+static void
+ip2k_init_libfuncs (void)
+{
+  set_optab_libfunc (smul_optab, SImode, "_mulsi3");
+  set_optab_libfunc (smul_optab, DImode, "_muldi3");
+  set_optab_libfunc (cmp_optab,  HImode, "_cmphi2");
+  set_optab_libfunc (cmp_optab,  SImode, "_cmpsi2");
+}
+
 /* Returns a bit position if mask contains only a single bit.  Returns -1 if
    there were zero or more than one set bits.  */
 int
index a60f527..d3d77dc 100644 (file)
@@ -863,21 +863,6 @@ extern int ip2k_reorg_merge_qimode;
 #define OUT_AS2(a,b,c) output_asm_insn (AS2 (a,b,c), operands)
 #define CR_TAB "\n\t"
 
-#define INIT_TARGET_OPTABS                             \
-{                                                      \
-  smul_optab->handlers[(int) SImode].libfunc           \
-    = gen_rtx_SYMBOL_REF (Pmode, "_mulsi3");           \
-                                                       \
-  smul_optab->handlers[(int) DImode].libfunc           \
-    = gen_rtx_SYMBOL_REF (Pmode, "_muldi3");           \
-                                                       \
-  cmp_optab->handlers[(int) HImode].libfunc            \
-    = gen_rtx_SYMBOL_REF (Pmode, "_cmphi2");           \
-                                                       \
-  cmp_optab->handlers[(int) SImode].libfunc            \
-    = gen_rtx_SYMBOL_REF (Pmode, "_cmpsi2");           \
-}
-
 #define PREDICATE_CODES                                        \
   {"ip2k_ip_operand", {MEM}},                          \
   {"ip2k_short_operand", {MEM}},                       \
index 677fee6..15fa240 100644 (file)
@@ -643,16 +643,6 @@ typedef struct iq2000_args {
 }
 
 \f
-/* Implicit Calls to Library Routines.  */
-
-#define INIT_TARGET_OPTABS                                             \
-do                                                                     \
-  {                                                                    \
-    INIT_SUBTARGET_OPTABS;                                             \
-  }                                                                    \
-while (0)
-
-\f
 /* Addressing Modes.  */
 
 #define CONSTANT_ADDRESS_P(X)                                          \
@@ -1420,10 +1410,6 @@ extern void              sbss_section (void);
 #define DONT_ACCESS_GBLS_AFTER_EPILOGUE 0
 \f
 
-#ifndef INIT_SUBTARGET_OPTABS
-#define INIT_SUBTARGET_OPTABS
-#endif
-
 enum iq2000_builtins
 {
   IQ2000_BUILTIN_ADO16,
index 30f55d5..5126721 100644 (file)
@@ -50,6 +50,7 @@ Note:
 #include "flags.h"
 #include "recog.h"
 #include "expr.h"
+#include "libfuncs.h"
 #include "toplev.h"
 #include "basic-block.h"
 #include "function.h"
@@ -85,6 +86,7 @@ static void m68hc11_file_start PARAMS ((void));
 static void m68hc11_encode_section_info PARAMS((tree, rtx, int));
 static int autoinc_mode PARAMS((rtx));
 static int m68hc11_make_autoinc_notes PARAMS((rtx *, void *));
+static void m68hc11_init_libfuncs PARAMS ((void));
 
 /* Must be set to 1 to produce debug messages.  */
 int debug_m6811 = 0;
@@ -246,6 +248,9 @@ static int nb_soft_regs;
 #undef TARGET_MACHINE_DEPENDENT_REORG
 #define TARGET_MACHINE_DEPENDENT_REORG m68hc11_reorg
 
+#undef TARGET_INIT_LIBFUNCS
+#define TARGET_INIT_LIBFUNCS m68hc11_init_libfuncs
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
 int
@@ -5257,6 +5262,17 @@ m68hc11_reorg ()
   }
 }
 \f
+/* Override memcpy */
+
+static void
+m68hc11_init_libfuncs (void)
+{
+  memcpy_libfunc = init_one_libfunc ("__memcpy");
+  memcmp_libfunc = init_one_libfunc ("__memcmp");
+  memset_libfunc = init_one_libfunc ("__memset");
+}
+
+\f
 
 /* Cost functions.  */
 
index 16ba624..7c1c7f3 100644 (file)
@@ -1176,23 +1176,6 @@ typedef struct m68hc11_args
   m68hc11_initialize_trampoline ((TRAMP), (FNADDR), (CXT))
 
 \f
-/* `INIT_TARGET_OPTABS'
-     Define this macro as a C statement that declares additional library
-     routines renames existing ones. `init_optabs' calls this macro
-     after initializing all the normal library routines.
-
-     Overrides the memcpy */
-
-#define INIT_TARGET_OPTABS                                             \
-do                                                                     \
-  {                                                                    \
-    memcpy_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__memcpy");           \
-    memcmp_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__memcmp");           \
-    memset_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__memset");           \
-  }                                                                    \
-while (0)
-
-\f
 /* Addressing modes, and classification of registers for them.  */
 
 /* The 68HC12 has all the post/pre increment/decrement modes.  */
index a2232f0..12a3ef3 100644 (file)
@@ -41,6 +41,8 @@ Boston, MA 02111-1307, USA.  */
 #include "tree.h"
 #include "function.h"
 #include "expr.h"
+#include "optabs.h"
+#include "libfuncs.h"
 #include "flags.h"
 #include "reload.h"
 #include "tm_p.h"
@@ -255,6 +257,7 @@ static const struct mips_cpu_info *mips_cpu_info_from_isa (int);
 static int mips_adjust_cost (rtx, rtx, rtx, int);
 static int mips_issue_rate (void);
 static int mips_use_dfa_pipeline_interface (void);
+static void mips_init_libfuncs (void);
 
 #ifdef TARGET_IRIX6
 static void iris6_asm_named_section_1 (const char *, unsigned int,
@@ -787,6 +790,9 @@ const struct mips_cpu_info mips_cpu_info_table[] = {
 #define TARGET_SECTION_TYPE_FLAGS iris6_section_type_flags
 #endif
 
+#undef TARGET_INIT_LIBFUNCS
+#define TARGET_INIT_LIBFUNCS mips_init_libfuncs
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
 /* Return true if RELOC is a valid relocation number and OFFSET can be
@@ -8986,6 +8992,55 @@ mips_reorg (void)
     }
 }
 
+/* We need to use a special set of functions to handle hard floating
+   point code in mips16 mode.  Also, allow for --enable-gofast.  */
+
+#include "config/gofast.h"
+
+static void
+mips_init_libfuncs (void)
+{
+  if (TARGET_MIPS16 && mips16_hard_float)
+    {
+      set_optab_libfunc (add_optab, SFmode, "__mips16_addsf3");
+      set_optab_libfunc (sub_optab, SFmode, "__mips16_subsf3");
+      set_optab_libfunc (smul_optab, SFmode, "__mips16_mulsf3");
+      set_optab_libfunc (sdiv_optab, SFmode, "__mips16_divsf3");
+
+      eqsf2_libfunc     = init_one_libfunc ("__mips16_eqsf2");
+      nesf2_libfunc     = init_one_libfunc ("__mips16_nesf2");
+      gtsf2_libfunc     = init_one_libfunc ("__mips16_gtsf2");
+      gesf2_libfunc     = init_one_libfunc ("__mips16_gesf2");
+      ltsf2_libfunc     = init_one_libfunc ("__mips16_ltsf2");
+      lesf2_libfunc     = init_one_libfunc ("__mips16_lesf2");
+
+      floatsisf_libfunc = init_one_libfunc ("__mips16_floatsisf");
+      fixsfsi_libfunc   = init_one_libfunc ("__mips16_fixsfsi");
+
+      if (TARGET_DOUBLE_FLOAT)
+       {
+         set_optab_libfunc (add_optab, DFmode, "__mips16_adddf3");
+         set_optab_libfunc (sub_optab, DFmode, "__mips16_subdf3");
+         set_optab_libfunc (smul_optab, DFmode, "__mips16_muldf3");
+         set_optab_libfunc (sdiv_optab, DFmode, "__mips16_divdf3");
+
+         eqdf2_libfunc       = init_one_libfunc ("__mips16_eqdf2");
+         nedf2_libfunc       = init_one_libfunc ("__mips16_nedf2");
+         gtdf2_libfunc       = init_one_libfunc ("__mips16_gtdf2");
+         gedf2_libfunc       = init_one_libfunc ("__mips16_gedf2");
+         ltdf2_libfunc       = init_one_libfunc ("__mips16_ltdf2");
+         ledf2_libfunc       = init_one_libfunc ("__mips16_ledf2");
+
+         floatsidf_libfunc   = init_one_libfunc ("__mips16_floatsidf");
+         fixdfsi_libfunc     = init_one_libfunc ("__mips16_fixdfsi");
+
+         extendsfdf2_libfunc = init_one_libfunc ("__mips16_extendsfdf2");
+         truncdfsf2_libfunc  = init_one_libfunc ("__mips16_truncdfsf2");
+       }
+    }
+  else
+    gofast_maybe_init_libfuncs ();
+}
 
 /* Return a number assessing the cost of moving a register in class
    FROM to class TO.  The classes are expressed using the enumeration
index 30ddcc4..a3a2715 100644 (file)
@@ -3451,78 +3451,6 @@ while (0)
                                         && mips_abi != ABI_32          \
                                         && mips_abi != ABI_O64)
 \f
-/* We need to use a special set of functions to handle hard floating
-   point code in mips16 mode.  */
-
-#ifndef INIT_SUBTARGET_OPTABS
-#define INIT_SUBTARGET_OPTABS
-#endif
-
-#define INIT_TARGET_OPTABS                                             \
-do                                                                     \
-  {                                                                    \
-    if (! TARGET_MIPS16 || ! mips16_hard_float)                                \
-      INIT_SUBTARGET_OPTABS;                                           \
-    else                                                               \
-      {                                                                        \
-       add_optab->handlers[(int) SFmode].libfunc =                     \
-         init_one_libfunc ("__mips16_addsf3");                         \
-       sub_optab->handlers[(int) SFmode].libfunc =                     \
-         init_one_libfunc ("__mips16_subsf3");                         \
-       smul_optab->handlers[(int) SFmode].libfunc =                    \
-         init_one_libfunc ("__mips16_mulsf3");                         \
-       sdiv_optab->handlers[(int) SFmode].libfunc =                    \
-         init_one_libfunc ("__mips16_divsf3");                         \
-                                                                       \
-       eqsf2_libfunc = init_one_libfunc ("__mips16_eqsf2");            \
-       nesf2_libfunc = init_one_libfunc ("__mips16_nesf2");            \
-       gtsf2_libfunc = init_one_libfunc ("__mips16_gtsf2");            \
-       gesf2_libfunc = init_one_libfunc ("__mips16_gesf2");            \
-       ltsf2_libfunc = init_one_libfunc ("__mips16_ltsf2");            \
-       lesf2_libfunc = init_one_libfunc ("__mips16_lesf2");            \
-                                                                       \
-       floatsisf_libfunc =                                             \
-         init_one_libfunc ("__mips16_floatsisf");                      \
-       fixsfsi_libfunc =                                               \
-         init_one_libfunc ("__mips16_fixsfsi");                        \
-                                                                       \
-       if (TARGET_DOUBLE_FLOAT)                                        \
-         {                                                             \
-           add_optab->handlers[(int) DFmode].libfunc =                 \
-             init_one_libfunc ("__mips16_adddf3");                     \
-           sub_optab->handlers[(int) DFmode].libfunc =                 \
-             init_one_libfunc ("__mips16_subdf3");                     \
-           smul_optab->handlers[(int) DFmode].libfunc =                \
-             init_one_libfunc ("__mips16_muldf3");                     \
-           sdiv_optab->handlers[(int) DFmode].libfunc =                \
-             init_one_libfunc ("__mips16_divdf3");                     \
-                                                                       \
-           extendsfdf2_libfunc =                                       \
-             init_one_libfunc ("__mips16_extendsfdf2");                \
-           truncdfsf2_libfunc =                                        \
-             init_one_libfunc ("__mips16_truncdfsf2");                 \
-                                                                       \
-           eqdf2_libfunc =                                             \
-             init_one_libfunc ("__mips16_eqdf2");                      \
-           nedf2_libfunc =                                             \
-             init_one_libfunc ("__mips16_nedf2");                      \
-           gtdf2_libfunc =                                             \
-             init_one_libfunc ("__mips16_gtdf2");                      \
-           gedf2_libfunc =                                             \
-             init_one_libfunc ("__mips16_gedf2");                      \
-           ltdf2_libfunc =                                             \
-             init_one_libfunc ("__mips16_ltdf2");                      \
-           ledf2_libfunc =                                             \
-             init_one_libfunc ("__mips16_ledf2");                      \
-                                                                       \
-           floatsidf_libfunc =                                         \
-             init_one_libfunc ("__mips16_floatsidf");                  \
-           fixdfsi_libfunc =                                           \
-             init_one_libfunc ("__mips16_fixdfsi");                    \
-         }                                                             \
-      }                                                                        \
-  }                                                                    \
-while (0)
 
 #define DFMODE_NAN \
        unsigned short DFbignan[4] = {0x7ff7, 0xffff, 0xffff, 0xffff}; \
diff --git a/gcc/config/pa/long_double.h b/gcc/config/pa/long_double.h
deleted file mode 100644 (file)
index 11504ca..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-/* Definitions of long double support for GNU compiler.
-   Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GCC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-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.  */
-
-#define LONG_DOUBLE_TYPE_SIZE 128
-
-/* Define library calls for quad FP operations.  These are all part of the
-   PA32 and PA64 ABIs.  */
-#define ADDTF3_LIBCALL "_U_Qfadd"
-#define SUBTF3_LIBCALL "_U_Qfsub"
-#define MULTF3_LIBCALL "_U_Qfmpy"
-#define DIVTF3_LIBCALL "_U_Qfdiv"
-#define NEGTF2_LIBCALL "_U_Qfneg"
-#define SQRTTF2_LIBCALL "_U_Qfsqrt"
-#define ABSTF2_LIBCALL "_U_Qfabs"
-#define SMINTF3_LIBCALL "_U_Qfmin"
-#define SMAXTF3_LIBCALL "_U_Qfmax"
-#define EXTENDSFTF2_LIBCALL "_U_Qfcnvff_sgl_to_quad"
-#define EXTENDDFTF2_LIBCALL "_U_Qfcnvff_dbl_to_quad"
-#define TRUNCTFSF2_LIBCALL "_U_Qfcnvff_quad_to_sgl"
-#define TRUNCTFDF2_LIBCALL "_U_Qfcnvff_quad_to_dbl"
-#define FLOATSITF2_LIBCALL "_U_Qfcnvxf_sgl_to_quad"
-#define FLOATDITF2_LIBCALL "_U_Qfcnvxf_dbl_to_quad"
-/* We need to put a wrapper function around _U_Qfcnvfxt_quad_to_sgl so that
-   we can massage its return value for PA64.  */
-#define FIX_TRUNCTFSI2_LIBCALL \
-  (TARGET_64BIT ? "__U_Qfcnvfxt_quad_to_sgl" : "_U_Qfcnvfxt_quad_to_sgl")
-#define FIXUNS_TRUNCTFSI2_LIBCALL "_U_Qfcnvfxt_quad_to_usgl"
-#define FIXUNS_TRUNCTFDI2_LIBCALL "_U_Qfcnvfxt_quad_to_udbl"
-#define FIX_TRUNCTFDI2_LIBCALL "_U_Qfcnvfxt_quad_to_dbl"
-#define EQTF2_LIBCALL "_U_Qfeq"
-#define NETF2_LIBCALL "_U_Qfne"
-#define GTTF2_LIBCALL "_U_Qfgt"
-#define GETF2_LIBCALL "_U_Qfge"
-#define LTTF2_LIBCALL "_U_Qflt"
-#define LETF2_LIBCALL "_U_Qfle"
-
-
-#define INIT_TARGET_OPTABS                                             \
-  do {                                                                 \
-    add_optab->handlers[(int) TFmode].libfunc                          \
-      = gen_rtx_SYMBOL_REF (Pmode, ADDTF3_LIBCALL);                    \
-    sub_optab->handlers[(int) TFmode].libfunc                          \
-      = gen_rtx_SYMBOL_REF (Pmode, SUBTF3_LIBCALL);                    \
-    smul_optab->handlers[(int) TFmode].libfunc                         \
-      = gen_rtx_SYMBOL_REF (Pmode, MULTF3_LIBCALL);                    \
-    sdiv_optab->handlers[(int) TFmode].libfunc                         \
-      = gen_rtx_SYMBOL_REF (Pmode, DIVTF3_LIBCALL);                    \
-    smin_optab->handlers[(int) TFmode].libfunc                         \
-      = gen_rtx_SYMBOL_REF (Pmode, SMINTF3_LIBCALL);                   \
-    smax_optab->handlers[(int) TFmode].libfunc                         \
-      = gen_rtx_SYMBOL_REF (Pmode, SMAXTF3_LIBCALL);                   \
-    sqrt_optab->handlers[(int) TFmode].libfunc                         \
-      = gen_rtx_SYMBOL_REF (Pmode, SQRTTF2_LIBCALL);                   \
-    abs_optab->handlers[(int) TFmode].libfunc                          \
-      = gen_rtx_SYMBOL_REF (Pmode, ABSTF2_LIBCALL);                    \
-    neg_optab->handlers[(int) TFmode].libfunc                          \
-      = gen_rtx_SYMBOL_REF (Pmode, NEGTF2_LIBCALL);                    \
-    extendsftf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, EXTENDSFTF2_LIBCALL); \
-    extenddftf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, EXTENDDFTF2_LIBCALL); \
-    trunctfsf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, TRUNCTFSF2_LIBCALL); \
-    trunctfdf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, TRUNCTFDF2_LIBCALL); \
-    floatsitf_libfunc = gen_rtx_SYMBOL_REF (Pmode, FLOATSITF2_LIBCALL);  \
-    floatditf_libfunc = gen_rtx_SYMBOL_REF (Pmode, FLOATDITF2_LIBCALL);  \
-    fixtfsi_libfunc = gen_rtx_SYMBOL_REF (Pmode, FIX_TRUNCTFSI2_LIBCALL);\
-    fixtfdi_libfunc = gen_rtx_SYMBOL_REF (Pmode, FIX_TRUNCTFDI2_LIBCALL);\
-    fixunstfsi_libfunc = gen_rtx_SYMBOL_REF (Pmode, FIXUNS_TRUNCTFSI2_LIBCALL);\
-    fixunstfdi_libfunc = gen_rtx_SYMBOL_REF (Pmode, FIXUNS_TRUNCTFDI2_LIBCALL);\
-    eqtf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, EQTF2_LIBCALL);         \
-    netf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, NETF2_LIBCALL);         \
-    gttf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, GTTF2_LIBCALL);         \
-    getf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, GETF2_LIBCALL);         \
-    lttf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, LTTF2_LIBCALL);         \
-    letf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, LETF2_LIBCALL);         \
-    INIT_SUBTARGET_OPTABS;                                             \
-  } while (0)
-
-/* This is meant to be redefined in the host dependent files */
-#define INIT_SUBTARGET_OPTABS
-
-/* Nonzero if a floating point comparison library call for
-   mode MODE that will return a boolean value.  Zero if one
-   of the libgcc2 functions is used.  */
-#define FLOAT_LIB_COMPARE_RETURNS_BOOL(MODE, COMPARISON) ((MODE) == TFmode)
index bea7331..24aefc3 100644 (file)
@@ -28,6 +28,10 @@ Boston, MA 02111-1307, USA.  */
 #define SIZE_TYPE "unsigned int"
 #define PTRDIFF_TYPE "int"
 
+#define LONG_DOUBLE_TYPE_SIZE 128
+#define HPUX_LONG_DOUBLE_LIBRARY
+#define FLOAT_LIB_COMPARE_RETURNS_BOOL(MODE, COMPARISON) ((MODE) == TFmode)
+
 /* GCC always defines __STDC__.  HP C++ compilers don't define it.  This
    causes trouble when sys/stdsyms.h is included.  As a work around,
    we define __STDC_EXT__.  A similar situation exists with respect to
index 68b05db..6134b0b 100644 (file)
@@ -145,6 +145,9 @@ static void pa_linux_file_start (void) ATTRIBUTE_UNUSED;
 static void pa_hpux64_gas_file_start (void) ATTRIBUTE_UNUSED;
 static void pa_hpux64_hpas_file_start (void) ATTRIBUTE_UNUSED;
 static void output_deferred_plabels (void);
+#ifdef HPUX_LONG_DOUBLE_LIBRARY
+static void pa_hpux_init_libfuncs (void);
+#endif
 
 /* Save the operands last given to a compare for use when we
    generate a scc or bcc insn.  */
@@ -253,6 +256,11 @@ static size_t n_deferred_plabels = 0;
 #undef TARGET_MACHINE_DEPENDENT_REORG
 #define TARGET_MACHINE_DEPENDENT_REORG pa_reorg
 
+#ifdef HPUX_LONG_DOUBLE_LIBRARY
+#undef TARGET_INIT_LIBFUNCS
+#define TARGET_INIT_LIBFUNCS pa_hpux_init_libfuncs
+#endif
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
 void
@@ -4950,6 +4958,43 @@ output_deferred_plabels (void)
     }
 }
 
+#ifdef HPUX_LONG_DOUBLE_LIBRARY
+/* Initialize optabs to point to HPUX long double emulation routines.  */
+static void
+pa_hpux_init_libfuncs (void)
+{
+  set_optab_libfunc (add_optab, TFmode, "_U_Qfadd");
+  set_optab_libfunc (sub_optab, TFmode, "_U_Qfsub");
+  set_optab_libfunc (smul_optab, TFmode, "_U_Qfmpy");
+  set_optab_libfunc (sdiv_optab, TFmode, "_U_Qfdiv");
+  set_optab_libfunc (smin_optab, TFmode, "_U_Qmin");
+  set_optab_libfunc (smax_optab, TFmode, "_U_Qfmax");
+  set_optab_libfunc (sqrt_optab, TFmode, "_U_Qfsqrt");
+  set_optab_libfunc (abs_optab, TFmode, "_U_Qfabs");
+  set_optab_libfunc (neg_optab, TFmode, "_U_Qfneg");
+
+  eqtf2_libfunc = init_one_libfunc ("_U_Qfeq");
+  netf2_libfunc = init_one_libfunc ("_U_Qfne");
+  gttf2_libfunc = init_one_libfunc ("_U_Qfgt");
+  getf2_libfunc = init_one_libfunc ("_U_Qfge");
+  lttf2_libfunc = init_one_libfunc ("_U_Qflt");
+  letf2_libfunc = init_one_libfunc ("_U_Qfle");
+
+  extendsftf2_libfunc = init_one_libfunc ("_U_Qfcnvff_sgl_to_quad");
+  extenddftf2_libfunc = init_one_libfunc ("_U_Qfcnvff_dbl_to_quad");
+  trunctfsf2_libfunc = init_one_libfunc ("_U_Qfcnvff_quad_to_sgl");
+  trunctfdf2_libfunc = init_one_libfunc ("_U_Qfcnvff_quad_to_dbl");
+  floatsitf_libfunc = init_one_libfunc ("_U_Qfcnvxf_sgl_to_quad");
+  floatditf_libfunc = init_one_libfunc ("_U_Qfcnvxf_dbl_to_quad");
+  fixtfsi_libfunc = init_one_libfunc (TARGET_64BIT
+                                     ? "__U_Qfcnvfxt_quad_to_sgl"
+                                     : "_U_Qfcnvfxt_quad_to_sgl");
+  fixtfdi_libfunc = init_one_libfunc ("_U_Qfcnvfxt_quad_to_dbl");
+  fixunstfsi_libfunc = init_one_libfunc ("_U_Qfcnvfxt_quad_to_usgl");
+  fixunstfdi_libfunc = init_one_libfunc ("_U_Qfcnvfxt_quad_to_udbl");
+}
+#endif
+
 /* HP's millicode routines mean something special to the assembler.
    Keep track of which ones we have used.  */
 
index 991d2c3..269a670 100644 (file)
 /* Define cutoff for using external functions to save floating point.  */
 #define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) == 62 || (FIRST_REG) == 63)
 
-/* Optabs entries for the int->float routines and quad FP operations
-   using the standard AIX names.  */
-#define ADDTF3_LIBCALL "_xlqadd"
-#define DIVTF3_LIBCALL "_xlqdiv"
-#define MULTF3_LIBCALL "_xlqmul"
-#define SUBTF3_LIBCALL "_xlqsub"
-
-#define INIT_TARGET_OPTABS                                             \
-  do {                                                                 \
-    if (! TARGET_POWER2 && ! TARGET_POWERPC && TARGET_HARD_FLOAT)      \
-      {                                                                        \
-       fixdfsi_libfunc = init_one_libfunc (RS6000_ITRUNC);             \
-       fixunsdfsi_libfunc = init_one_libfunc (RS6000_UITRUNC);         \
-      }                                                                        \
-    if (TARGET_HARD_FLOAT)                                             \
-      {                                                                        \
-       add_optab->handlers[(int) TFmode].libfunc                       \
-         = init_one_libfunc (ADDTF3_LIBCALL);                          \
-       sub_optab->handlers[(int) TFmode].libfunc                       \
-         = init_one_libfunc (SUBTF3_LIBCALL);                          \
-       smul_optab->handlers[(int) TFmode].libfunc                      \
-         = init_one_libfunc (MULTF3_LIBCALL);                          \
-       sdiv_optab->handlers[(int) TFmode].libfunc                      \
-         = init_one_libfunc (DIVTF3_LIBCALL);                          \
-      }                                                                        \
-  } while (0)
-
 /* __throw will restore its own return address to be the same as the
    return address of the function that the throw is being made to.
    This is unfortunate, because we want to check the original
index c3e532e..0a4ebe1 100644 (file)
@@ -37,6 +37,7 @@
 #include "tree.h"
 #include "expr.h"
 #include "optabs.h"
+#include "libfuncs.h"
 #include "except.h"
 #include "function.h"
 #include "output.h"
@@ -279,6 +280,7 @@ static rtx rs6000_expand_ternop_builtin (enum insn_code, tree, rtx);
 static rtx rs6000_expand_builtin (tree, rtx, rtx, enum machine_mode, int);
 static void altivec_init_builtins (void);
 static void rs6000_common_init_builtins (void);
+static void rs6000_init_libfuncs (void);
 
 static void enable_mask_for_builtins (struct builtin_description *,
                                              int, enum rs6000_builtins,
@@ -467,6 +469,9 @@ static const char alt_reg_names[][8] =
 #undef TARGET_EXPAND_BUILTIN
 #define TARGET_EXPAND_BUILTIN rs6000_expand_builtin
 
+#undef TARGET_INIT_LIBFUNCS
+#define TARGET_INIT_LIBFUNCS rs6000_init_libfuncs
+
 #if TARGET_MACHO
 #undef TARGET_BINDS_LOCAL_P
 #define TARGET_BINDS_LOCAL_P rs6000_binds_local_p
@@ -6768,6 +6773,57 @@ rs6000_common_init_builtins (void)
     }
 }
 
+static void
+rs6000_init_libfuncs (void)
+{
+  if (!TARGET_HARD_FLOAT)
+    return;
+
+  if (TARGET_AIX)
+    {
+      /* Optabs entries for the int->float routines and quad FP
+        operations using the standard AIX names.  */
+      if (! TARGET_POWER2 && ! TARGET_POWERPC)
+       {
+         fixdfsi_libfunc = init_one_libfunc ("__itrunc");
+         fixunsdfsi_libfunc = init_one_libfunc ("__uitrunc");
+       }
+
+      set_optab_libfunc (add_optab, TFmode, "_xlqadd");
+      set_optab_libfunc (sub_optab, TFmode, "_xlqsub");
+      set_optab_libfunc (smul_optab, TFmode, "_xlqmul");
+      set_optab_libfunc (sdiv_optab, TFmode, "_xlqdiv");
+    }
+  else if (TARGET_ELF)
+    {
+      /* Define library calls for quad FP operations.  These are all
+        part of the PowerPC 32bit ABI.  */
+
+      set_optab_libfunc (add_optab, TFmode, "_q_add");
+      set_optab_libfunc (sub_optab, TFmode, "_q_sub");
+      set_optab_libfunc (neg_optab, TFmode, "_q_neg");
+      set_optab_libfunc (smul_optab, TFmode, "_q_mul");
+      set_optab_libfunc (sdiv_optab, TFmode, "_q_div");
+      if (TARGET_PPC_GPOPT || TARGET_POWER2)
+       set_optab_libfunc (sqrt_optab, TFmode, "_q_sqrt");
+
+      eqtf2_libfunc = init_one_libfunc ("_q_feq");
+      netf2_libfunc = init_one_libfunc ("_q_fne");
+      gttf2_libfunc = init_one_libfunc ("_q_fgt");
+      getf2_libfunc = init_one_libfunc ("_q_fge");
+      lttf2_libfunc = init_one_libfunc ("_q_flt");
+      letf2_libfunc = init_one_libfunc ("_q_fle");
+      trunctfsf2_libfunc = init_one_libfunc ("_q_qtos");
+      trunctfdf2_libfunc = init_one_libfunc ("_q_qtod");
+      extendsftf2_libfunc = init_one_libfunc ("_q_stoq");
+      extenddftf2_libfunc = init_one_libfunc ("_q_dtoq");
+      floatsitf_libfunc = init_one_libfunc ("_q_itoq");
+      fixtfsi_libfunc = init_one_libfunc ("_q_qtoi");
+      fixunstfsi_libfunc = init_one_libfunc ("_q_qtou");
+    }
+}
+
+
 \f
 /* Expand a block move operation, and return 1 if successful.  Return 0
    if we should let the compiler generate normal code.
index 3e8b354..45928e4 100644 (file)
@@ -1275,63 +1275,6 @@ ncrtn.o%s"
 
 #define HANDLE_PRAGMA_PACK_PUSH_POP 1
 
-/* Define library calls for quad FP operations.  These are all part of the
-   PowerPC 32bit ABI.  */
-#define ADDTF3_LIBCALL "_q_add"
-#define DIVTF3_LIBCALL "_q_div"
-#define EXTENDDFTF2_LIBCALL "_q_dtoq"
-#define EQTF2_LIBCALL "_q_feq"
-#define GETF2_LIBCALL "_q_fge"
-#define GTTF2_LIBCALL "_q_fgt"
-#define LETF2_LIBCALL "_q_fle"
-#define LTTF2_LIBCALL "_q_flt"
-#define NETF2_LIBCALL "_q_fne"
-#define FLOATSITF2_LIBCALL "_q_itoq"
-#define MULTF3_LIBCALL "_q_mul"
-#define NEGTF2_LIBCALL "_q_neg"
-#define TRUNCTFDF2_LIBCALL "_q_qtod"
-#define FIX_TRUNCTFSI2_LIBCALL "_q_qtoi"
-#define TRUNCTFSF2_LIBCALL "_q_qtos"
-#define FIXUNS_TRUNCTFSI2_LIBCALL "_q_qtou"
-#define SQRTTF_LIBCALL "_q_sqrt"
-#define EXTENDSFTF2_LIBCALL "_q_stoq"
-#define SUBTF3_LIBCALL "_q_sub"
-#define FLOATUNSSITF2_LIBCALL "_q_utoq"
-
-#define INIT_TARGET_OPTABS                                             \
-  do {                                                                 \
-    if (TARGET_HARD_FLOAT)                                             \
-      {                                                                        \
-       add_optab->handlers[(int) TFmode].libfunc                       \
-         = init_one_libfunc (ADDTF3_LIBCALL);                          \
-       sub_optab->handlers[(int) TFmode].libfunc                       \
-         = init_one_libfunc (SUBTF3_LIBCALL);                          \
-       neg_optab->handlers[(int) TFmode].libfunc                       \
-         = init_one_libfunc (NEGTF2_LIBCALL);                          \
-       smul_optab->handlers[(int) TFmode].libfunc                      \
-         = init_one_libfunc (MULTF3_LIBCALL);                          \
-       sdiv_optab->handlers[(int) TFmode].libfunc                      \
-         = init_one_libfunc (DIVTF3_LIBCALL);                          \
-       eqtf2_libfunc = init_one_libfunc (EQTF2_LIBCALL);               \
-       netf2_libfunc = init_one_libfunc (NETF2_LIBCALL);               \
-       gttf2_libfunc = init_one_libfunc (GTTF2_LIBCALL);               \
-       getf2_libfunc = init_one_libfunc (GETF2_LIBCALL);               \
-       lttf2_libfunc = init_one_libfunc (LTTF2_LIBCALL);               \
-       letf2_libfunc = init_one_libfunc (LETF2_LIBCALL);               \
-       trunctfsf2_libfunc = init_one_libfunc (TRUNCTFSF2_LIBCALL);     \
-       trunctfdf2_libfunc = init_one_libfunc (TRUNCTFDF2_LIBCALL);     \
-       extendsftf2_libfunc = init_one_libfunc (EXTENDSFTF2_LIBCALL);   \
-       extenddftf2_libfunc = init_one_libfunc (EXTENDDFTF2_LIBCALL);   \
-       floatsitf_libfunc = init_one_libfunc (FLOATSITF2_LIBCALL);      \
-       fixtfsi_libfunc = init_one_libfunc (FIX_TRUNCTFSI2_LIBCALL);    \
-       fixunstfsi_libfunc                                              \
-         = init_one_libfunc (FIXUNS_TRUNCTFSI2_LIBCALL);               \
-       if (TARGET_PPC_GPOPT || TARGET_POWER2)                          \
-         sqrt_optab->handlers[(int) TFmode].libfunc                    \
-           = init_one_libfunc (SQRTTF_LIBCALL);                        \
-      }                                                                        \
-  } while (0)
-
 /* Select a format to encode pointers in exception handling data.  CODE
    is 0 for data, 1 for code labels, 2 for function pointers.  GLOBAL is
    true if the symbol may be affected by dynamic relocations.  */
index 26d79ec..9bc7c1f 100644 (file)
@@ -177,13 +177,6 @@ toc_section ()                                             \
 #undef  RS6000_MCOUNT
 #define RS6000_MCOUNT ".__mcount"
 
-/* Function names to call to do floating point truncation.  */
-
-#undef  RS6000_ITRUNC
-#define RS6000_ITRUNC "__itrunc"
-#undef  RS6000_UITRUNC
-#define RS6000_UITRUNC "__uitrunc"
-
 /* This outputs NAME to FILE up to the first null or '['.  */
 
 #define RS6000_OUTPUT_BASENAME(FILE, NAME) \
index 8ba256c..5f01a34 100644 (file)
@@ -42,14 +42,9 @@ Boston, MA 02111-1307, USA.  */
 #undef STDC_0_IN_SYSTEM_HEADERS
 
 /* We don't want to use the Solaris2 specific long long int conversion
-   routines.  */
-#undef INIT_SUBTARGET_OPTABS
-#define INIT_SUBTARGET_OPTABS
-
-/* ??? We haven't added Solaris2 equivalent 64 bit library routines to
-   lb1sp*.asm, so we need to avoid using them.  */
-#undef MULDI3_LIBCALL
-#undef DIVDI3_LIBCALL
-#undef UDIVDI3_LIBCALL
-#undef MODDI3_LIBCALL
-#undef UMODDI3_LIBCALL
+   routines or 64-bit integer multiply and divide routines.  */
+#undef SUN_CONVERSION_LIBFUNCS
+#define SUN_CONVERSION_LIBFUNCS 0
+
+#undef SUN_INTEGER_MULTIPLY_64
+#define SUN_INTEGER_MULTIPLY_64 0
index 9b1875a..cac67ec 100644 (file)
@@ -27,6 +27,5 @@ Boston, MA 02111-1307, USA.  */
 #undef TARGET_DEFAULT
 #define TARGET_DEFAULT MASK_APP_REGS
 
-/* US Software GOFAST library support.  */
-#undef INIT_SUBTARGET_OPTABS
-#define INIT_SUBTARGET_OPTABS INIT_GOFAST_OPTABS
+/* Enable US Software GOFAST library support.  */
+#define US_SOFTWARE_GOFAST
index 6d5cce1..b336907 100644 (file)
@@ -43,9 +43,8 @@ Boston, MA 02111-1307, USA.  */
 #undef TARGET_DEFAULT
 #define TARGET_DEFAULT MASK_APP_REGS
 
-/* US Software GOFAST library support.  */
-#undef INIT_SUBTARGET_OPTABS
-#define INIT_SUBTARGET_OPTABS INIT_GOFAST_OPTABS      
+/* Enable US Software GOFAST library support.  */
+#define US_SOFTWARE_GOFAST
 
 #undef STARTFILE_SPEC
 #define STARTFILE_SPEC "crti.o%s crtbegin.o%s"
index 94706b4..4ac2fda 100644 (file)
@@ -98,19 +98,6 @@ Boston, MA 02111-1307, USA.  */
 #undef TARGET_VERSION
 #define TARGET_VERSION fprintf (stderr, " (%s)", TARGET_NAME);
 
-/*
- * Clean up afterwards generic SPARC ELF configuration.
- */
-
-/* FIXME: Aren't these supposed to be available for SPARC ELF?  */
-#undef MULDI3_LIBCALL
-#undef DIVDI3_LIBCALL
-#undef UDIVDI3_LIBCALL
-#undef MODDI3_LIBCALL
-#undef UMODDI3_LIBCALL
-#undef INIT_SUBTARGET_OPTABS  
-#define INIT_SUBTARGET_OPTABS  
-
 /* Below here exists the merged NetBSD/sparc & NetBSD/sparc64 compiler
    description, allowing one to build 32 bit or 64 bit applications
    on either.  We define the sparc & sparc64 versions of things,
index efb49c8..47204f4 100644 (file)
@@ -108,28 +108,17 @@ Boston, MA 02111-1307, USA.  */
 /* But indicate that it isn't supported by the hardware.  */
 #define WIDEST_HARDWARE_FP_SIZE 64
 
-#define MULDI3_LIBCALL "__mul64"
-#define DIVDI3_LIBCALL "__div64"
-#define UDIVDI3_LIBCALL "__udiv64"
-#define MODDI3_LIBCALL "__rem64"
-#define UMODDI3_LIBCALL "__urem64"
-
 /* Solaris's _Qp_* library routine implementation clobbers the output
    memory before the inputs are fully consumed.  */
 
 #undef TARGET_BUGGY_QP_LIB
 #define TARGET_BUGGY_QP_LIB    1
 
-#undef INIT_SUBTARGET_OPTABS
-#define INIT_SUBTARGET_OPTABS                                          \
-  fixsfdi_libfunc                                                      \
-    = init_one_libfunc (TARGET_ARCH64 ? "__ftol" : "__ftoll");         \
-  fixunssfdi_libfunc                                                   \
-    = init_one_libfunc (TARGET_ARCH64 ? "__ftoul" : "__ftoull");       \
-  fixdfdi_libfunc                                                      \
-    = init_one_libfunc (TARGET_ARCH64 ? "__dtol" : "__dtoll");         \
-  fixunsdfdi_libfunc                                                   \
-    = init_one_libfunc (TARGET_ARCH64 ? "__dtoul" : "__dtoull")
+#undef SOLARIS_CONVERSION_LIBFUNCS
+#define SOLARIS_CONVERSION_LIBFUNCS 1
+
+#undef SUN_INTEGER_MULTIPLY_64
+#define SUN_INTEGER_MULTIPLY_64 1
 
 /* Solaris allows 64 bit out and global registers in 32 bit mode.
    sparc_override_options will disable V8+ if not generating V9 code.  */
index 2a8f6a1..04ed624 100644 (file)
@@ -46,9 +46,8 @@ Boston, MA 02111-1307, USA.  */
 #undef ASM_SPEC
 #define ASM_SPEC "%{v:-V} %{mlittle-endian-data:--little-endian-data} %(asm_cpu)"
 
-/* US Software GOFAST library support.  */
-#undef INIT_SUBTARGET_OPTABS
-#define INIT_SUBTARGET_OPTABS INIT_GOFAST_OPTABS      
+/* Enable US Software GOFAST library support.  */
+#define US_SOFTWARE_GOFAST
 
 #undef STARTFILE_SPEC
 #define STARTFILE_SPEC "crti.o%s crtbegin.o%s"
index 8441783..28275b7 100644 (file)
@@ -180,6 +180,7 @@ static void emit_soft_tfmode_cvt (enum rtx_code, rtx *);
 static void emit_hard_tfmode_operation (enum rtx_code, rtx *);
 
 static bool sparc_function_ok_for_sibcall (tree, tree);
+static void sparc_init_libfuncs (void);
 static void sparc_output_mi_thunk (FILE *, tree, HOST_WIDE_INT,
                                   HOST_WIDE_INT, tree);
 static struct machine_function * sparc_init_machine_status (void);
@@ -252,6 +253,9 @@ enum processor_type sparc_cpu;
 #undef TARGET_FUNCTION_OK_FOR_SIBCALL
 #define TARGET_FUNCTION_OK_FOR_SIBCALL sparc_function_ok_for_sibcall
 
+#undef TARGET_INIT_LIBFUNCS
+#define TARGET_INIT_LIBFUNCS sparc_init_libfuncs
+
 #ifdef HAVE_AS_TLS
 #undef TARGET_HAVE_TLS
 #define TARGET_HAVE_TLS true
@@ -8386,7 +8390,96 @@ sparc_function_ok_for_sibcall (tree decl, tree exp ATTRIBUTE_UNUSED)
          && ! TARGET_FLAT
          && (TARGET_ARCH64 || ! current_function_returns_struct));
 }
+\f
+/* libfunc renaming.  */
+#include "config/gofast.h"
+
+static void
+sparc_init_libfuncs (void)
+{
+  if (TARGET_ARCH32)
+    {
+      /* Use the subroutines that Sun's library provides for integer
+        multiply and divide.  The `*' prevents an underscore from
+        being prepended by the compiler. .umul is a little faster
+        than .mul. */
+      set_optab_libfunc (smul_optab, SImode, "*.umul");
+      set_optab_libfunc (sdiv_optab, SImode, "*.div");
+      set_optab_libfunc (udiv_optab, SImode, "*.udiv");
+      set_optab_libfunc (smod_optab, SImode, "*.rem");
+      set_optab_libfunc (umod_optab, SImode, "*.urem");
+
+      /* TFmode arithmetic.  These names are part of the SPARC 32bit ABI.  */
+      set_optab_libfunc (add_optab, TFmode, "_Q_add");
+      set_optab_libfunc (sub_optab, TFmode, "_Q_sub");
+      set_optab_libfunc (neg_optab, TFmode, "_Q_neg");
+      set_optab_libfunc (smul_optab, TFmode, "_Q_mul");
+      set_optab_libfunc (sdiv_optab, TFmode, "_Q_div");
+
+      /* We can define the TFmode sqrt optab only if TARGET_FPU.  This
+        is because with soft-float, the SFmode and DFmode sqrt
+        instructions will be absent, and the compiler will notice and
+        try to use the TFmode sqrt instruction for calls to the
+        builtin function sqrt, but this fails.  */
+      if (TARGET_FPU)
+       set_optab_libfunc (sqrt_optab, TFmode, "_Q_sqrt");
+
+      eqtf2_libfunc = init_one_libfunc ("_Q_feq");
+      netf2_libfunc = init_one_libfunc ("_Q_fne");
+      gttf2_libfunc = init_one_libfunc ("_Q_fgt");
+      getf2_libfunc = init_one_libfunc ("_Q_fge");
+      lttf2_libfunc = init_one_libfunc ("_Q_flt");
+      letf2_libfunc = init_one_libfunc ("_Q_fle");
+
+      trunctfsf2_libfunc = init_one_libfunc ("_Q_qtos");
+      trunctfdf2_libfunc = init_one_libfunc ("_Q_qtod");
+      extendsftf2_libfunc = init_one_libfunc ("_Q_stoq");
+      extenddftf2_libfunc = init_one_libfunc ("_Q_dtoq");
+      floatsitf_libfunc = init_one_libfunc ("_Q_itoq");
+      fixtfsi_libfunc = init_one_libfunc ("_Q_qtoi");
+      fixunstfsi_libfunc = init_one_libfunc ("_Q_qtou");
+
+      if (SUN_CONVERSION_LIBFUNCS)
+       {
+         fixsfdi_libfunc = init_one_libfunc ("__ftoll");
+         fixunssfdi_libfunc = init_one_libfunc ("__ftoull");
+         fixdfdi_libfunc = init_one_libfunc ("__dtoll");
+         fixunsdfdi_libfunc = init_one_libfunc ("__dtoull");
+       }
+    }
+  if (TARGET_ARCH64)
+    {
+      /* In the SPARC 64bit ABI, SImode multiply and divide functions
+        do not exist in the library.  Make sure the compiler does not
+        emit calls to them by accident.  (It should always use the
+         hardware instructions.)  */
+      set_optab_libfunc (smul_optab, SImode, 0);
+      set_optab_libfunc (sdiv_optab, SImode, 0);
+      set_optab_libfunc (udiv_optab, SImode, 0);
+      set_optab_libfunc (smod_optab, SImode, 0);
+      set_optab_libfunc (umod_optab, SImode, 0);
+
+      if (SUN_INTEGER_MULTIPLY_64)
+       {
+         set_optab_libfunc (smul_optab, DImode, "__mul64");
+         set_optab_libfunc (sdiv_optab, DImode, "__div64");
+         set_optab_libfunc (udiv_optab, DImode, "__udiv64");
+         set_optab_libfunc (smod_optab, DImode, "__rem64");
+         set_optab_libfunc (umod_optab, DImode, "__urem64");
+       }
+
+      if (SUN_CONVERSION_LIBFUNCS)
+       {
+         fixsfdi_libfunc = init_one_libfunc ("__ftol");
+         fixunssfdi_libfunc = init_one_libfunc ("__ftoul");
+         fixdfdi_libfunc = init_one_libfunc ("__dtol");
+         fixunsdfdi_libfunc = init_one_libfunc ("__dtoul");
+       }
+    }
 
+  gofast_maybe_init_libfuncs ();
+}
+\f
 /* ??? Similar to the standard section selection, but force reloc-y-ness
    if SUNOS4_SHARED_LIBRARIES.  Unclear why this helps (as opposed to
    pretending PIC always on), but that's what the old code did.  */
index 118e37d..77de509 100644 (file)
@@ -2411,100 +2411,19 @@ do {                                                                    \
 /* alloca should avoid clobbering the old register save area.  */
 #define SETJMP_VIA_SAVE_AREA
 
-/* Define subroutines to call to handle multiply and divide.
-   Use the subroutines that Sun's library provides.
-   The `*' prevents an underscore from being prepended by the compiler.  */
-
-#define DIVSI3_LIBCALL "*.div"
-#define UDIVSI3_LIBCALL "*.udiv"
-#define MODSI3_LIBCALL "*.rem"
-#define UMODSI3_LIBCALL "*.urem"
-/* .umul is a little faster than .mul.  */
-#define MULSI3_LIBCALL "*.umul"
-
-/* Define library calls for quad FP operations.  These are all part of the
-   SPARC 32bit ABI.  */
-#define ADDTF3_LIBCALL "_Q_add"
-#define SUBTF3_LIBCALL "_Q_sub"
-#define NEGTF2_LIBCALL "_Q_neg"
-#define MULTF3_LIBCALL "_Q_mul"
-#define DIVTF3_LIBCALL "_Q_div"
-#define FLOATSITF2_LIBCALL "_Q_itoq"
-#define FIX_TRUNCTFSI2_LIBCALL "_Q_qtoi"
-#define FIXUNS_TRUNCTFSI2_LIBCALL "_Q_qtou"
-#define EXTENDSFTF2_LIBCALL "_Q_stoq"
-#define TRUNCTFSF2_LIBCALL "_Q_qtos"
-#define EXTENDDFTF2_LIBCALL "_Q_dtoq"
-#define TRUNCTFDF2_LIBCALL "_Q_qtod"
-#define EQTF2_LIBCALL "_Q_feq"
-#define NETF2_LIBCALL "_Q_fne"
-#define GTTF2_LIBCALL "_Q_fgt"
-#define GETF2_LIBCALL "_Q_fge"
-#define LTTF2_LIBCALL "_Q_flt"
-#define LETF2_LIBCALL "_Q_fle"
+/* The _Q_* comparison libcalls return booleans.  */
+#define FLOAT_LIB_COMPARE_RETURNS_BOOL(MODE, COMPARISON) ((MODE) == TFmode)
 
 /* Assume by default that the _Qp_* 64-bit libcalls are implemented such
    that the inputs are fully consumed before the output memory is clobbered.  */
 
 #define TARGET_BUGGY_QP_LIB    0
 
-/* We can define the TFmode sqrt optab only if TARGET_FPU.  This is because
-   with soft-float, the SFmode and DFmode sqrt instructions will be absent,
-   and the compiler will notice and try to use the TFmode sqrt instruction
-   for calls to the builtin function sqrt, but this fails.  */
-#define INIT_TARGET_OPTABS                                             \
-  do {                                                                 \
-    if (TARGET_ARCH32)                                                 \
-      {                                                                        \
-       add_optab->handlers[(int) TFmode].libfunc                       \
-         = init_one_libfunc (ADDTF3_LIBCALL);                          \
-       sub_optab->handlers[(int) TFmode].libfunc                       \
-         = init_one_libfunc (SUBTF3_LIBCALL);                          \
-       neg_optab->handlers[(int) TFmode].libfunc                       \
-         = init_one_libfunc (NEGTF2_LIBCALL);                          \
-       smul_optab->handlers[(int) TFmode].libfunc                      \
-         = init_one_libfunc (MULTF3_LIBCALL);                          \
-       sdiv_optab->handlers[(int) TFmode].libfunc                      \
-         = init_one_libfunc (DIVTF3_LIBCALL);                          \
-       eqtf2_libfunc = init_one_libfunc (EQTF2_LIBCALL);               \
-       netf2_libfunc = init_one_libfunc (NETF2_LIBCALL);               \
-       gttf2_libfunc = init_one_libfunc (GTTF2_LIBCALL);               \
-       getf2_libfunc = init_one_libfunc (GETF2_LIBCALL);               \
-       lttf2_libfunc = init_one_libfunc (LTTF2_LIBCALL);               \
-       letf2_libfunc = init_one_libfunc (LETF2_LIBCALL);               \
-       trunctfsf2_libfunc = init_one_libfunc (TRUNCTFSF2_LIBCALL);     \
-       trunctfdf2_libfunc = init_one_libfunc (TRUNCTFDF2_LIBCALL);     \
-       extendsftf2_libfunc = init_one_libfunc (EXTENDSFTF2_LIBCALL);   \
-       extenddftf2_libfunc = init_one_libfunc (EXTENDDFTF2_LIBCALL);   \
-       floatsitf_libfunc = init_one_libfunc (FLOATSITF2_LIBCALL);      \
-       fixtfsi_libfunc = init_one_libfunc (FIX_TRUNCTFSI2_LIBCALL);    \
-       fixunstfsi_libfunc                                              \
-         = init_one_libfunc (FIXUNS_TRUNCTFSI2_LIBCALL);               \
-       if (TARGET_FPU)                                                 \
-         sqrt_optab->handlers[(int) TFmode].libfunc                    \
-           = init_one_libfunc ("_Q_sqrt");                             \
-      }                                                                        \
-    if (TARGET_ARCH64)                                                 \
-      {                                                                        \
-        /* In the SPARC 64bit ABI, these libfuncs do not exist in the  \
-           library.  Make sure the compiler does not emit calls to them        \
-          by accident.  */                                             \
-       sdiv_optab->handlers[(int) SImode].libfunc = NULL;              \
-       udiv_optab->handlers[(int) SImode].libfunc = NULL;              \
-       smod_optab->handlers[(int) SImode].libfunc = NULL;              \
-       umod_optab->handlers[(int) SImode].libfunc = NULL;              \
-        smul_optab->handlers[(int) SImode].libfunc = NULL;             \
-      }                                                                        \
-    INIT_SUBTARGET_OPTABS;                                             \
-  } while (0)
-
-/* This is meant to be redefined in the host dependent files */
-#define INIT_SUBTARGET_OPTABS
+/* Assume by default that we do not have the Solaris-specific conversion
+   routines nor 64-bit integer multiply and divide routines.  */
 
-/* Nonzero if a floating point comparison library call for
-   mode MODE that will return a boolean value.  Zero if one
-   of the libgcc2 functions is used.  */
-#define FLOAT_LIB_COMPARE_RETURNS_BOOL(MODE, COMPARISON) ((MODE) == TFmode)
+#define SUN_CONVERSION_LIBFUNCS 0
+#define SUN_INTEGER_MULTIPLY_64 0
 
 /* Compute extra cost of moving data between one register class
    and another.  */
index 7ebf12d..4d681d4 100644 (file)
@@ -1323,23 +1323,6 @@ zbss_section ()                                                          \
    is done just by pretending it is already truncated.  */
 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
 
-#define MULDI3_LIBCALL  "__muldi3"
-#define UCMPDI2_LIBCALL "__ucmpdi2"
-#define CMPDI2_LIBCALL  "__cmpdi2"
-#define NEGDI2_LIBCALL  "__negdi2"
-
-#define INIT_TARGET_OPTABS                             \
-  do                                                   \
-    {                                                  \
-      cmp_optab->handlers[(int) DImode].libfunc                \
-       = init_one_libfunc (CMPDI2_LIBCALL);            \
-      ucmp_optab->handlers[(int) DImode].libfunc        \
-       = init_one_libfunc (UCMPDI2_LIBCALL);           \
-      neg_optab->handlers[(int) DImode].libfunc                \
-       = init_one_libfunc (NEGDI2_LIBCALL);            \
-    }                                                  \
-  while (0)
-
 /* Specify the machine mode that pointers have.
    After generation of rtl, the compiler makes no further distinction
    between pointers and any other objects of this machine mode.  */
index 122e3cf..533ce92 100644 (file)
@@ -19,6 +19,9 @@ 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.  */
 
+#undef TARGET_ELF
+#define TARGET_ELF 1
+
 #undef REGISTER_PREFIX
 #undef REGISTER_NAMES
 #define REGISTER_PREFIX "%"
@@ -70,12 +73,6 @@ Boston, MA 02111-1307, USA.  */
 #undef  ASM_OUTPUT_BEFORE_CASE_LABEL
 #define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE, PREFIX, NUM, TABLE)
 
-/* Get the udiv/urem calls out of the user's namespace.  */
-#undef  UDIVSI3_LIBCALL
-#define UDIVSI3_LIBCALL "*__udiv"
-#undef  UMODSI3_LIBCALL
-#define UMODSI3_LIBCALL "*__urem"
-
 #undef OVERRIDE_OPTIONS
 #define OVERRIDE_OPTIONS                       \
   do                                           \
index ad40e98..4f8ffb0 100644 (file)
@@ -35,6 +35,7 @@ Boston, MA 02111-1307, USA.  */
 #include "insn-attr.h"
 #include "recog.h"
 #include "expr.h"
+#include "optabs.h"
 #include "flags.h"
 #include "debug.h"
 #include "tm_p.h"
@@ -43,6 +44,7 @@ Boston, MA 02111-1307, USA.  */
 
 static void vax_output_function_prologue (FILE *, HOST_WIDE_INT);
 static void vax_file_start (void);
+static void vax_init_libfuncs (void);
 static void vax_output_mi_thunk (FILE *, tree, HOST_WIDE_INT,
                                 HOST_WIDE_INT, tree);
 static int vax_address_cost_1 (rtx);
@@ -62,6 +64,9 @@ static bool vax_rtx_costs (rtx, int, int, int *);
 #undef TARGET_ASM_FILE_START_APP_OFF
 #define TARGET_ASM_FILE_START_APP_OFF true
 
+#undef TARGET_INIT_LIBFUNCS
+#define TARGET_INIT_LIBFUNCS vax_init_libfuncs
+
 #undef TARGET_ASM_OUTPUT_MI_THUNK
 #define TARGET_ASM_OUTPUT_MI_THUNK vax_output_mi_thunk
 #undef TARGET_ASM_CAN_OUTPUT_MI_THUNK
@@ -141,6 +146,17 @@ vax_file_start (void)
     fprintf (asm_out_file, "___vax_%c_doubles:\n", ASM_DOUBLE_CHAR);
 }
 
+/* We can use the BSD C library routines for the libgcc calls that are
+   still generated, since that's what they boil down to anyways.  When
+   ELF, avoid the user's namespace.  */
+
+static void
+vax_init_libfuncs (void)
+{
+  set_optab_libfunc (udiv_optab, SImode, TARGET_ELF ? "*__udiv" : "*udiv");
+  set_optab_libfunc (umod_optab, SImode, TARGET_ELF ? "*__umod" : "*umod");
+}
+
 /* This is like nonimmediate_operand with a restriction on the type of MEM.  */
 
 void
index bb1450d..0bbcc27 100644 (file)
@@ -78,6 +78,9 @@ extern int target_flags;
 /* Nonzero if compiling with `G'-format floating point */
 #define TARGET_G_FLOAT (target_flags & MASK_G_FLOAT)
 
+/* Nonzero if ELF.  Redefined by vax/elf.h.  */
+#define TARGET_ELF 0
+
 /* Macro to define tables used to set the flags.
    This is a list in braces of pairs in braces,
    each pair being { "NAME", VALUE }
@@ -855,14 +858,6 @@ enum reg_class { NO_REGS, ALL_REGS, LIM_REG_CLASSES };
    used to replace branches can be expensive.  */
 
 #define BRANCH_COST 0
-
-/*
- * We can use the BSD C library routines for the libgcc calls that are
- * still generated, since that's what they boil down to anyways.
- */
-
-#define UDIVSI3_LIBCALL "*udiv"
-#define UMODSI3_LIBCALL "*urem"
 \f
 /* Tell final.c how to eliminate redundant test instructions.  */
 
index 60e2925..34e9f7b 100644 (file)
@@ -574,6 +574,10 @@ You Lose!  You must define PREFERRED_DEBUGGING_TYPE!
    && !ROUND_TOWARDS_ZERO)
 #endif
 
+#ifndef FLOAT_LIB_COMPARE_RETURNS_BOOL
+#define FLOAT_LIB_COMPARE_RETURNS_BOOL(MODE, COMPARISON) false
+#endif
+
 /* If FLOAT_WORDS_BIG_ENDIAN is not defined in the header files,
    then the word-endianness is the same as for integers.  */
 #ifndef FLOAT_WORDS_BIG_ENDIAN
index 74616d8..2fa6fbd 100644 (file)
@@ -4630,76 +4630,6 @@ special assembler code.
 @c prevent bad page break with this line
 Here is an explanation of implicit calls to library routines.
 
-@defmac MULSI3_LIBCALL
-A C string constant giving the name of the function to call for
-multiplication of one signed full-word by another.  If you do not
-define this macro, the default name is used, which is @code{__mulsi3},
-a function defined in @file{libgcc.a}.
-@end defmac
-
-@defmac DIVSI3_LIBCALL
-A C string constant giving the name of the function to call for
-division of one signed full-word by another.  If you do not define
-this macro, the default name is used, which is @code{__divsi3}, a
-function defined in @file{libgcc.a}.
-@end defmac
-
-@defmac UDIVSI3_LIBCALL
-A C string constant giving the name of the function to call for
-division of one unsigned full-word by another.  If you do not define
-this macro, the default name is used, which is @code{__udivsi3}, a
-function defined in @file{libgcc.a}.
-@end defmac
-
-@defmac MODSI3_LIBCALL
-A C string constant giving the name of the function to call for the
-remainder in division of one signed full-word by another.  If you do
-not define this macro, the default name is used, which is
-@code{__modsi3}, a function defined in @file{libgcc.a}.
-@end defmac
-
-@defmac UMODSI3_LIBCALL
-A C string constant giving the name of the function to call for the
-remainder in division of one unsigned full-word by another.  If you do
-not define this macro, the default name is used, which is
-@code{__umodsi3}, a function defined in @file{libgcc.a}.
-@end defmac
-
-@defmac MULDI3_LIBCALL
-A C string constant giving the name of the function to call for
-multiplication of one signed double-word by another.  If you do not
-define this macro, the default name is used, which is @code{__muldi3},
-a function defined in @file{libgcc.a}.
-@end defmac
-
-@defmac DIVDI3_LIBCALL
-A C string constant giving the name of the function to call for
-division of one signed double-word by another.  If you do not define
-this macro, the default name is used, which is @code{__divdi3}, a
-function defined in @file{libgcc.a}.
-@end defmac
-
-@defmac UDIVDI3_LIBCALL
-A C string constant giving the name of the function to call for
-division of one unsigned full-word by another.  If you do not define
-this macro, the default name is used, which is @code{__udivdi3}, a
-function defined in @file{libgcc.a}.
-@end defmac
-
-@defmac MODDI3_LIBCALL
-A C string constant giving the name of the function to call for the
-remainder in division of one signed double-word by another.  If you do
-not define this macro, the default name is used, which is
-@code{__moddi3}, a function defined in @file{libgcc.a}.
-@end defmac
-
-@defmac UMODDI3_LIBCALL
-A C string constant giving the name of the function to call for the
-remainder in division of one unsigned full-word by another.  If you do
-not define this macro, the default name is used, which is
-@code{__umoddi3}, a function defined in @file{libgcc.a}.
-@end defmac
-
 @defmac DECLARE_LIBRARY_RENAMES
 This macro, if defined, should expand to a piece of C code that will get
 expanded when compiling functions for libgcc.a.  It can be used to
@@ -4707,19 +4637,47 @@ provide alternate names for gcc's internal library functions if there
 are ABI-mandated names that the compiler should provide.
 @end defmac
 
-@defmac INIT_TARGET_OPTABS
-Define this macro as a C statement that declares additional library
-routines renames existing ones.  @code{init_optabs} calls this macro after
-initializing all the normal library routines.
-@end defmac
+@findex init_one_libfunc
+@findex set_optab_libfunc
+@deftypefn {Target Hook} void TARGET_INIT_LIBFUNCS (void)
+This hook should declare additional library routines or rename
+existing ones, using the functions @code{set_optab_libfunc} and
+@code{init_one_libfunc} defined in @file{optabs.c}.
+@code{init_optabs} calls this macro after initializing all the normal
+library routines.
 
-@defmac FLOAT_LIB_COMPARE_RETURNS_BOOL (@var{mode}, @var{comparison})
-Define this macro as a C statement that returns nonzero if a call to
-the floating point comparison library function will return a boolean
-value that indicates the result of the comparison.  It should return
-zero if one of gcc's own libgcc functions is called.
+The default is to do nothing.  Most ports don't need to define this hook.
+@end deftypefn
 
-Most ports don't need to define this macro.
+@defmac TARGET_FLOAT_LIB_COMPARE_RETURNS_BOOL (@var{mode}, @var{comparison})
+This macro should return @code{true} if the library routine that
+implements the floating point comparison operator @var{comparison} in
+mode @var{mode} will return a boolean, and @var{false} if it will
+return a tristate.
+
+GCC's own floating point libraries return tristates from the
+comparison operators, so the default returns false always.  Most ports
+don't need to define this macro.
+@end defmac
+
+@cindex US Software GOFAST, floating point emulation library
+@cindex floating point emulation library, US Software GOFAST
+@cindex GOFAST, floating point emulation library
+@findex gofast_maybe_init_libfuncs
+@defmac US_SOFTWARE_GOFAST
+Define this macro if your system C library uses the US Software GOFAST
+library to provide floating point emulation.  
+
+In addition to defining this macro, your architecture must set
+@code{TARGET_INIT_LIBFUNCS} to @code{gofast_maybe_init_libfuncs}, or
+else call that function from its version of that hook.  It is defined
+in @file{config/gofast.h}, which must be included by your
+architecture's @file{@var{cpu}.c} file.  See @file{sparc/sparc.c} for
+an example.
+
+If this macro is defined, the
+@code{TARGET_FLOAT_LIB_COMPARE_RETURNS_BOOL} target hook must return
+false for @code{SFmode} and @code{DFmode} comparisons.
 @end defmac
 
 @cindex @code{EDOM}, implicit usage
index e3138a1..c598ff7 100644 (file)
@@ -334,7 +334,6 @@ extern rtx expand_builtin (tree, rtx, rtx, enum machine_mode, int);
 extern void std_expand_builtin_va_start (tree, rtx);
 extern rtx std_expand_builtin_va_arg (tree, tree);
 extern rtx expand_builtin_va_arg (tree, tree);
-extern void default_init_builtins (void);
 extern rtx default_expand_builtin (tree, rtx, rtx, enum machine_mode, int);
 extern void expand_builtin_setjmp_setup (rtx, rtx);
 extern void expand_builtin_setjmp_receiver (rtx);
index e413d86..bd1b42a 100644 (file)
@@ -43,6 +43,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "ggc.h"
 #include "real.h"
 #include "basic-block.h"
+#include "target.h"
 
 /* Each optab contains info on how this target machine
    can perform a particular operation
@@ -4198,12 +4199,9 @@ prepare_float_lib_cmp (rtx *px, rtx *py, enum rtx_code *pcomparison,
   *px = result;
   *py = const0_rtx;
   *pmode = word_mode;
-  if (comparison == UNORDERED)
+  if (comparison == UNORDERED
+      || FLOAT_LIB_COMPARE_RETURNS_BOOL (mode, comparison))
     *pcomparison = NE;
-#ifdef FLOAT_LIB_COMPARE_RETURNS_BOOL
-  else if (FLOAT_LIB_COMPARE_RETURNS_BOOL (mode, comparison))
-    *pcomparison = NE;
-#endif
   *punsignedp = 0;
 }
 \f
@@ -5342,6 +5340,17 @@ init_one_libfunc (const char *name)
   return symbol;
 }
 
+/* Call this to reset the function entry for one optab (OPTABLE) in mode
+   MODE to NAME, which should be either 0 or a string constant.  */
+void
+set_optab_libfunc (optab optable, enum machine_mode mode, const char *name)
+{
+  if (name)
+    optable->handlers[mode].libfunc = init_one_libfunc (name);
+  else
+    optable->handlers[mode].libfunc = 0;
+}
+
 /* Call this once to initialize the contents of the optabs
    appropriately for the current target machine.  */
 
@@ -5521,51 +5530,6 @@ init_optabs (void)
   init_integral_libfuncs (ucmp_optab, "ucmp", '2');
   init_floating_libfuncs (cmp_optab, "cmp", '2');
 
-#ifdef MULSI3_LIBCALL
-  smul_optab->handlers[(int) SImode].libfunc
-    = init_one_libfunc (MULSI3_LIBCALL);
-#endif
-#ifdef MULDI3_LIBCALL
-  smul_optab->handlers[(int) DImode].libfunc
-    = init_one_libfunc (MULDI3_LIBCALL);
-#endif
-
-#ifdef DIVSI3_LIBCALL
-  sdiv_optab->handlers[(int) SImode].libfunc
-    = init_one_libfunc (DIVSI3_LIBCALL);
-#endif
-#ifdef DIVDI3_LIBCALL
-  sdiv_optab->handlers[(int) DImode].libfunc
-    = init_one_libfunc (DIVDI3_LIBCALL);
-#endif
-
-#ifdef UDIVSI3_LIBCALL
-  udiv_optab->handlers[(int) SImode].libfunc
-    = init_one_libfunc (UDIVSI3_LIBCALL);
-#endif
-#ifdef UDIVDI3_LIBCALL
-  udiv_optab->handlers[(int) DImode].libfunc
-    = init_one_libfunc (UDIVDI3_LIBCALL);
-#endif
-
-#ifdef MODSI3_LIBCALL
-  smod_optab->handlers[(int) SImode].libfunc
-    = init_one_libfunc (MODSI3_LIBCALL);
-#endif
-#ifdef MODDI3_LIBCALL
-  smod_optab->handlers[(int) DImode].libfunc
-    = init_one_libfunc (MODDI3_LIBCALL);
-#endif
-
-#ifdef UMODSI3_LIBCALL
-  umod_optab->handlers[(int) SImode].libfunc
-    = init_one_libfunc (UMODSI3_LIBCALL);
-#endif
-#ifdef UMODDI3_LIBCALL
-  umod_optab->handlers[(int) DImode].libfunc
-    = init_one_libfunc (UMODDI3_LIBCALL);
-#endif
-
   /* Use cabs for DC complex abs, since systems generally have cabs.
      Don't define any libcall for SCmode, so that cabs will be used.  */
   abs_optab->handlers[(int) DCmode].libfunc
@@ -5711,10 +5675,8 @@ init_optabs (void)
   if (HAVE_conditional_trap)
     trap_rtx = gen_rtx_fmt_ee (EQ, VOIDmode, NULL_RTX, NULL_RTX);
 
-#ifdef INIT_TARGET_OPTABS
   /* Allow the target to add more libcalls or rename some, etc.  */
-  INIT_TARGET_OPTABS;
-#endif
+  targetm.init_libfuncs ();
 }
 \f
 /* Generate insns to trap with code TCODE if OP1 and OP2 satisfy condition
index 27044ab..dc515b3 100644 (file)
@@ -366,6 +366,9 @@ extern rtx gen_extend_insn (rtx, rtx, enum machine_mode,
 extern void init_fixtab (void);
 extern void init_floattab (void);
 
+/* Call this to reset the function entry for one optab.  */
+extern void set_optab_libfunc (optab, enum machine_mode, const char *);
+
 /* Generate code for a FLOAT_EXPR.  */
 extern void expand_float (rtx, rtx, int);
 
index aa2d96a..e5606a3 100644 (file)
@@ -261,7 +261,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 #define TARGET_ADDRESS_COST default_address_cost
 
 /* In builtins.c.  */
-#define TARGET_INIT_BUILTINS default_init_builtins
+#define TARGET_INIT_BUILTINS hook_void_void
 #define TARGET_EXPAND_BUILTIN default_expand_builtin
 
 /* In varasm.c.  */
@@ -300,6 +300,10 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 #define TARGET_MS_BITFIELD_LAYOUT_P hook_bool_tree_false
 #define TARGET_RTX_COSTS hook_bool_rtx_int_int_intp_false
 
+#ifndef TARGET_INIT_LIBFUNCS
+#define TARGET_INIT_LIBFUNCS hook_void_void
+#endif
+
 #ifndef TARGET_IN_SMALL_DATA_P
 #define TARGET_IN_SMALL_DATA_P hook_bool_tree_false
 #endif
@@ -349,6 +353,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
   TARGET_MS_BITFIELD_LAYOUT_P,                 \
   TARGET_INIT_BUILTINS,                                \
   TARGET_EXPAND_BUILTIN,                       \
+  TARGET_INIT_LIBFUNCS,                                \
   TARGET_SECTION_TYPE_FLAGS,                   \
   TARGET_CANNOT_MODIFY_JUMPS_P,                        \
   TARGET_BRANCH_TARGET_REGISTER_CLASS, \
index 7ccca94..5a57128 100644 (file)
@@ -289,6 +289,9 @@ struct gcc_target
   rtx (* expand_builtin) (tree exp, rtx target, rtx subtarget,
                          enum machine_mode mode, int ignore);
 
+  /* Make any adjustments to libfunc names needed for this target.  */
+  void (* init_libfuncs) (void);
+
   /* Given a decl, a section name, and whether the decl initializer
      has relocs, choose attributes for the section.  */
   /* ??? Should be merged with SELECT_SECTION and UNIQUE_SECTION.  */