diff options
Diffstat (limited to 'gcc/config')
45 files changed, 581 insertions, 909 deletions
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index ad6b619..2340358 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -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"); + } +} + /* 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 diff --git a/gcc/config/alpha/unicosmk.h b/gcc/config/alpha/unicosmk.h index 5520bd5..a4789b0 100644 --- a/gcc/config/alpha/unicosmk.h +++ b/gcc/config/alpha/unicosmk.h @@ -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. */ diff --git a/gcc/config/alpha/vms.h b/gcc/config/alpha/vms.h index 7d10a1b..3bb9b59 100644 --- a/gcc/config/alpha/vms.h +++ b/gcc/config/alpha/vms.h @@ -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 diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index b574ad2..9dd4daa 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -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 */ diff --git a/gcc/config/avr/avr.h b/gcc/config/avr/avr.h index dc4737d..735e75d 100644 --- a/gcc/config/avr/avr.h +++ b/gcc/config/avr/avr.h @@ -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 diff --git a/gcc/config/c4x/c4x.c b/gcc/config/c4x/c4x.c index 2d8a8b6..ef58602 100644 --- a/gcc/config/c4x/c4x.c +++ b/gcc/config/c4x/c4x.c @@ -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); /* 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; /* 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); diff --git a/gcc/config/c4x/c4x.h b/gcc/config/c4x/c4x.h index 5a59740..1988ce6 100644 --- a/gcc/config/c4x/c4x.h +++ b/gcc/config/c4x/c4x.h @@ -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 diff --git a/gcc/config/cris/cris.c b/gcc/config/cris/cris.c index b4c064c..9213b1e 100644 --- a/gcc/config/cris/cris.c +++ b/gcc/config/cris/cris.c @@ -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 diff --git a/gcc/config/cris/cris.h b/gcc/config/cris/cris.h index 7995308..0dc57f4 100644 --- a/gcc/config/cris/cris.h +++ b/gcc/config/cris/cris.h @@ -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 diff --git a/gcc/config/frv/frv.c b/gcc/config/frv/frv.c index ddfec4e..09d6d97 100644 --- a/gcc/config/frv/frv.c +++ b/gcc/config/frv/frv.c @@ -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 diff --git a/gcc/config/frv/frv.h b/gcc/config/frv/frv.h index c820cfd..cd8019f 100644 --- a/gcc/config/frv/frv.h +++ b/gcc/config/frv/frv.h @@ -2224,101 +2224,6 @@ __asm__("\n" \ "\tjmpl @(gr0,gr6)\n"); -/* 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) - - /* Addressing Modes. */ /* A C expression that is 1 if the RTX X is a constant which is a valid diff --git a/gcc/config/gofast.h b/gcc/config/gofast.h index 3af267c..74a22c7 100644 --- a/gcc/config/gofast.h +++ b/gcc/config/gofast.h @@ -1,5 +1,5 @@ /* US Software GOFAST floating point library support. - Copyright (C) 1994, 1998, 1999, 2002 Free Software Foundation, Inc. + Copyright (C) 1994, 1998, 1999, 2002, 2003 Free Software Foundation, Inc. This file is part of GCC. @@ -18,91 +18,62 @@ along with GCC; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* This is used by fp-bit.c. */ -#define US_SOFTWARE_GOFAST - /* The US Software GOFAST library requires special optabs support. - There is no negation libcall, and several others have names different - from gcc. This file consolidates the support in one place. + This file is intended to be included by config/ARCH/ARCH.c. It + defines one function, gofast_maybe_init_libfuncs, which should be + called from the TARGET_INIT_LIBFUNCS hook. When tm.h has defined + US_SOFTWARE_GOFAST, this function will adjust all the optabs and + libfuncs appropriately. Otherwise it will do nothing. */ + +static void +gofast_maybe_init_libfuncs (void) +{ +#ifdef US_SOFTWARE_GOFAST + int mode; + + set_optab_libfunc (add_optab, SFmode, "fpadd"); + set_optab_libfunc (add_optab, DFmode, "dpadd"); + set_optab_libfunc (sub_optab, SFmode, "fpsub"); + set_optab_libfunc (sub_optab, DFmode, "dpsub"); + set_optab_libfunc (smul_optab, SFmode, "fpmul"); + set_optab_libfunc (smul_optab, DFmode, "dpmul"); + set_optab_libfunc (sdiv_optab, SFmode, "fpdiv"); + set_optab_libfunc (sdiv_optab, DFmode, "dpdiv"); + set_optab_libfunc (cmp_optab, SFmode, "fpcmp"); + set_optab_libfunc (cmp_optab, DFmode, "dpcmp"); + + /* GOFAST does not provide libfuncs for negation, so we use the + standard names. */ - The basic plan is to leave gcc proper alone and via some hook fix things - after the optabs have been set up. Our main entry point is - INIT_GOFAST_OPTABS. */ + /* GCC does not use fpcmp/dpcmp for gt or ge because its own + FP-emulation library returns +1 for both > and unord. So we + leave gt and ge unset, such that, instead of fpcmp(a,b) >[=], we + generate fpcmp(b,a) <[=] 0, which is unambiguous. For unord + libfuncs, we use our own functions, since GOFAST doesn't supply + them. */ -#define INIT_GOFAST_OPTABS \ - do { \ - GOFAST_CLEAR_NEG_FLOAT_OPTAB; \ - GOFAST_RENAME_LIBCALLS; \ - } while (0) + eqsf2_libfunc = init_one_libfunc ("fpcmp"); + nesf2_libfunc = init_one_libfunc ("fpcmp"); + gtsf2_libfunc = NULL_RTX; + gesf2_libfunc = NULL_RTX; + ltsf2_libfunc = init_one_libfunc ("fpcmp"); + lesf2_libfunc = init_one_libfunc ("fpcmp"); -#define GOFAST_CLEAR_NEG_FLOAT_OPTAB \ - do { \ - int mode; \ - for (mode = SFmode; (int) mode <= (int) TFmode; \ - mode = (enum machine_mode) ((int) mode + 1)) \ - neg_optab->handlers[(int) mode].libfunc = NULL_RTX; \ - } while (0) + eqdf2_libfunc = init_one_libfunc ("dpcmp"); + nedf2_libfunc = init_one_libfunc ("dpcmp"); + gtdf2_libfunc = NULL_RTX; + gedf2_libfunc = NULL_RTX; + ltdf2_libfunc = init_one_libfunc ("dpcmp"); + ledf2_libfunc = init_one_libfunc ("dpcmp"); -/* GCC does not use fpcmp/dpcmp for gt or ge because its own - FP-emulation library returns +1 for both > and unord. So we leave - gt and ge unset, such that, instead of fpcmp(a,b) >[=], we generate - fpcmp(b,a) <[=] 0, which is unambiguous. For unord libfuncs, we - use our own functions, since GOFAST doesn't supply them. */ -#define GOFAST_RENAME_LIBCALLS \ - add_optab->handlers[(int) SFmode].libfunc = init_one_libfunc ("fpadd"); \ - add_optab->handlers[(int) DFmode].libfunc = init_one_libfunc ("dpadd"); \ - sub_optab->handlers[(int) SFmode].libfunc = init_one_libfunc ("fpsub"); \ - sub_optab->handlers[(int) DFmode].libfunc = init_one_libfunc ("dpsub"); \ - smul_optab->handlers[(int) SFmode].libfunc = init_one_libfunc ("fpmul"); \ - smul_optab->handlers[(int) DFmode].libfunc = init_one_libfunc ("dpmul"); \ - sdiv_optab->handlers[(int) SFmode].libfunc = init_one_libfunc ("fpdiv"); \ - sdiv_optab->handlers[(int) DFmode].libfunc = init_one_libfunc ("dpdiv"); \ - cmp_optab->handlers[(int) SFmode].libfunc = init_one_libfunc ("fpcmp"); \ - cmp_optab->handlers[(int) DFmode].libfunc = init_one_libfunc ("dpcmp"); \ -\ - extendsfdf2_libfunc = init_one_libfunc ("fptodp"); \ - truncdfsf2_libfunc = init_one_libfunc ("dptofp"); \ -\ - eqhf2_libfunc = NULL_RTX; \ - nehf2_libfunc = NULL_RTX; \ - gthf2_libfunc = NULL_RTX; \ - gehf2_libfunc = NULL_RTX; \ - lthf2_libfunc = NULL_RTX; \ - lehf2_libfunc = NULL_RTX; \ -\ - eqsf2_libfunc = init_one_libfunc ("fpcmp"); \ - nesf2_libfunc = init_one_libfunc ("fpcmp"); \ - gtsf2_libfunc = NULL_RTX; \ - gesf2_libfunc = NULL_RTX; \ - ltsf2_libfunc = init_one_libfunc ("fpcmp"); \ - lesf2_libfunc = init_one_libfunc ("fpcmp"); \ -\ - eqdf2_libfunc = init_one_libfunc ("dpcmp"); \ - nedf2_libfunc = init_one_libfunc ("dpcmp"); \ - gtdf2_libfunc = NULL_RTX; \ - gedf2_libfunc = NULL_RTX; \ - ltdf2_libfunc = init_one_libfunc ("dpcmp"); \ - ledf2_libfunc = init_one_libfunc ("dpcmp"); \ -\ - eqxf2_libfunc = NULL_RTX; \ - nexf2_libfunc = NULL_RTX; \ - gtxf2_libfunc = NULL_RTX; \ - gexf2_libfunc = NULL_RTX; \ - ltxf2_libfunc = NULL_RTX; \ - lexf2_libfunc = NULL_RTX; \ -\ - eqtf2_libfunc = NULL_RTX; \ - netf2_libfunc = NULL_RTX; \ - gttf2_libfunc = NULL_RTX; \ - getf2_libfunc = NULL_RTX; \ - lttf2_libfunc = NULL_RTX; \ - letf2_libfunc = NULL_RTX; \ -\ - floatsisf_libfunc = init_one_libfunc ("sitofp"); \ - floatsidf_libfunc = init_one_libfunc ("litodp"); \ - fixsfsi_libfunc = init_one_libfunc ("fptosi"); \ - fixdfsi_libfunc = init_one_libfunc ("dptoli"); \ - fixunssfsi_libfunc = init_one_libfunc ("fptoui"); \ - fixunsdfsi_libfunc = init_one_libfunc ("dptoul"); \ + extendsfdf2_libfunc = init_one_libfunc ("fptodp"); + truncdfsf2_libfunc = init_one_libfunc ("dptofp"); -/* End of GOFAST_RENAME_LIBCALLS */ + floatsisf_libfunc = init_one_libfunc ("sitofp"); + floatsidf_libfunc = init_one_libfunc ("litodp"); + fixsfsi_libfunc = init_one_libfunc ("fptosi"); + fixdfsi_libfunc = init_one_libfunc ("dptoli"); + fixunssfsi_libfunc = init_one_libfunc ("fptoui"); + fixunsdfsi_libfunc = init_one_libfunc ("dptoul"); +#endif +} diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c index 3d874c2..5f21a0a 100644 --- a/gcc/config/h8300/h8300.c +++ b/gcc/config/h8300/h8300.c @@ -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; } +/* 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"); +} + /* 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; diff --git a/gcc/config/h8300/h8300.h b/gcc/config/h8300/h8300.h index c4103d0..b31bdf5 100644 --- a/gcc/config/h8300/h8300.h +++ b/gcc/config/h8300/h8300.h @@ -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. */ diff --git a/gcc/config/i860/i860.c b/gcc/config/i860/i860.c index f56de28..a8585ef 100644 --- a/gcc/config/i860/i860.c +++ b/gcc/config/i860/i860.c @@ -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; diff --git a/gcc/config/i860/i860.h b/gcc/config/i860/i860.h index f5ce0b1..11aa529 100644 --- a/gcc/config/i860/i860.h +++ b/gcc/config/i860/i860.h @@ -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 diff --git a/gcc/config/ia64/hpux.h b/gcc/config/ia64/hpux.h index b2b854b..be2470c 100644 --- a/gcc/config/ia64/hpux.h +++ b/gcc/config/ia64/hpux.h @@ -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 index ec704bd..0000000 --- a/gcc/config/ia64/hpux_longdouble.h +++ /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) diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index f82981b0..1633a58 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -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"); +} /* Switch to the section to which we should output X. The only thing special we do here is to honor small data. */ diff --git a/gcc/config/ip2k/ip2k.c b/gcc/config/ip2k/ip2k.c index aecb744..e31347f 100644 --- a/gcc/config/ip2k/ip2k.c +++ b/gcc/config/ip2k/ip2k.c @@ -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 diff --git a/gcc/config/ip2k/ip2k.h b/gcc/config/ip2k/ip2k.h index a60f527..d3d77dc 100644 --- a/gcc/config/ip2k/ip2k.h +++ b/gcc/config/ip2k/ip2k.h @@ -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}}, \ diff --git a/gcc/config/iq2000/iq2000.h b/gcc/config/iq2000/iq2000.h index 677fee6..15fa240 100644 --- a/gcc/config/iq2000/iq2000.h +++ b/gcc/config/iq2000/iq2000.h @@ -643,16 +643,6 @@ typedef struct iq2000_args { } -/* Implicit Calls to Library Routines. */ - -#define INIT_TARGET_OPTABS \ -do \ - { \ - INIT_SUBTARGET_OPTABS; \ - } \ -while (0) - - /* Addressing Modes. */ #define CONSTANT_ADDRESS_P(X) \ @@ -1420,10 +1410,6 @@ extern void sbss_section (void); #define DONT_ACCESS_GBLS_AFTER_EPILOGUE 0 -#ifndef INIT_SUBTARGET_OPTABS -#define INIT_SUBTARGET_OPTABS -#endif - enum iq2000_builtins { IQ2000_BUILTIN_ADO16, diff --git a/gcc/config/m68hc11/m68hc11.c b/gcc/config/m68hc11/m68hc11.c index 30f55d5..5126721 100644 --- a/gcc/config/m68hc11/m68hc11.c +++ b/gcc/config/m68hc11/m68hc11.c @@ -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; int @@ -5257,6 +5262,17 @@ m68hc11_reorg () } } +/* 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"); +} + + /* Cost functions. */ diff --git a/gcc/config/m68hc11/m68hc11.h b/gcc/config/m68hc11/m68hc11.h index 16ba6247..7c1c7f3 100644 --- a/gcc/config/m68hc11/m68hc11.h +++ b/gcc/config/m68hc11/m68hc11.h @@ -1176,23 +1176,6 @@ typedef struct m68hc11_args m68hc11_initialize_trampoline ((TRAMP), (FNADDR), (CXT)) -/* `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) - - /* Addressing modes, and classification of registers for them. */ /* The 68HC12 has all the post/pre increment/decrement modes. */ diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index a2232f0..12a3ef3 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -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; /* 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 diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index 30ddcc4..a3a2715 100644 --- a/gcc/config/mips/mips.h +++ b/gcc/config/mips/mips.h @@ -3451,78 +3451,6 @@ while (0) && mips_abi != ABI_32 \ && mips_abi != ABI_O64) -/* 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 index 11504ca..0000000 --- a/gcc/config/pa/long_double.h +++ /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) diff --git a/gcc/config/pa/pa-hpux.h b/gcc/config/pa/pa-hpux.h index bea7331..24aefc3 100644 --- a/gcc/config/pa/pa-hpux.h +++ b/gcc/config/pa/pa-hpux.h @@ -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 diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index 68b05db..6134b0b 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -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; 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. */ diff --git a/gcc/config/rs6000/aix.h b/gcc/config/rs6000/aix.h index 991d2c3..269a670 100644 --- a/gcc/config/rs6000/aix.h +++ b/gcc/config/rs6000/aix.h @@ -198,33 +198,6 @@ /* 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 diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index c3e532e..0a4ebe1 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -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"); + } +} + + /* Expand a block move operation, and return 1 if successful. Return 0 if we should let the compiler generate normal code. diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h index 3e8b354..45928e4 100644 --- a/gcc/config/rs6000/sysv4.h +++ b/gcc/config/rs6000/sysv4.h @@ -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. */ diff --git a/gcc/config/rs6000/xcoff.h b/gcc/config/rs6000/xcoff.h index 26d79ec..9bc7c1f 100644 --- a/gcc/config/rs6000/xcoff.h +++ b/gcc/config/rs6000/xcoff.h @@ -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) \ diff --git a/gcc/config/sparc/elf.h b/gcc/config/sparc/elf.h index 8ba256c..5f01a34 100644 --- a/gcc/config/sparc/elf.h +++ b/gcc/config/sparc/elf.h @@ -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 diff --git a/gcc/config/sparc/lite.h b/gcc/config/sparc/lite.h index 9b1875a..cac67ec 100644 --- a/gcc/config/sparc/lite.h +++ b/gcc/config/sparc/lite.h @@ -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 diff --git a/gcc/config/sparc/liteelf.h b/gcc/config/sparc/liteelf.h index 6d5cce1..b336907 100644 --- a/gcc/config/sparc/liteelf.h +++ b/gcc/config/sparc/liteelf.h @@ -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" diff --git a/gcc/config/sparc/netbsd-elf.h b/gcc/config/sparc/netbsd-elf.h index 94706b4..4ac2fda 100644 --- a/gcc/config/sparc/netbsd-elf.h +++ b/gcc/config/sparc/netbsd-elf.h @@ -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, diff --git a/gcc/config/sparc/sol2.h b/gcc/config/sparc/sol2.h index efb49c8..47204f4 100644 --- a/gcc/config/sparc/sol2.h +++ b/gcc/config/sparc/sol2.h @@ -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. */ diff --git a/gcc/config/sparc/sp86x-elf.h b/gcc/config/sparc/sp86x-elf.h index 2a8f6a1..04ed624 100644 --- a/gcc/config/sparc/sp86x-elf.h +++ b/gcc/config/sparc/sp86x-elf.h @@ -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" diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index 8441783..28275b7 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -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)); } + +/* 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 (); +} + /* ??? 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. */ diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h index 118e37d..77de509 100644 --- a/gcc/config/sparc/sparc.h +++ b/gcc/config/sparc/sparc.h @@ -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. */ diff --git a/gcc/config/v850/v850.h b/gcc/config/v850/v850.h index 7ebf12d..4d681d4 100644 --- a/gcc/config/v850/v850.h +++ b/gcc/config/v850/v850.h @@ -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. */ diff --git a/gcc/config/vax/elf.h b/gcc/config/vax/elf.h index 122e3cf..533ce92 100644 --- a/gcc/config/vax/elf.h +++ b/gcc/config/vax/elf.h @@ -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 \ diff --git a/gcc/config/vax/vax.c b/gcc/config/vax/vax.c index ad40e982..4f8ffb0 100644 --- a/gcc/config/vax/vax.c +++ b/gcc/config/vax/vax.c @@ -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 diff --git a/gcc/config/vax/vax.h b/gcc/config/vax/vax.h index bb1450d..0bbcc27 100644 --- a/gcc/config/vax/vax.h +++ b/gcc/config/vax/vax.h @@ -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" /* Tell final.c how to eliminate redundant test instructions. */ |