From 6bc709c1c5cf974a180d9fe141594aee17285e8a Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Thu, 20 May 2004 02:15:45 +0000 Subject: [PATCH] re PR target/15383 (__float128 function name is used for long double) 2004-05-19 H.J. Lu PR target/15383 * config/ia64/ia64.c (ia64_expand_compare): Don't check TARGET_HPUX for TFmode compare. Abort if op0 is in TFmode and cmptf_libfunc isn't set. (ia64_init_libfuncs): Rename TFmode libfuncs using the HPUX conventions. (ia64_sysv4_init_libfuncs): New. * config/ia64/sysv4.h (TARGET_INIT_LIBFUNCS): New. Defined as ia64_sysv4_init_libfuncs. From-SVN: r82047 --- gcc/ChangeLog | 13 ++++++++ gcc/config/ia64/ia64.c | 73 ++++++++++++++++++++++++++++------------- gcc/config/ia64/sysv4.h | 3 ++ 3 files changed, 66 insertions(+), 23 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6cc921fc091..1c9c6ce2913 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2004-05-19 H.J. Lu + + PR target/15383 + * config/ia64/ia64.c (ia64_expand_compare): Don't check + TARGET_HPUX for TFmode compare. Abort if op0 is in TFmode and + cmptf_libfunc isn't set. + (ia64_init_libfuncs): Rename TFmode libfuncs using the HPUX + conventions. + (ia64_sysv4_init_libfuncs): New. + + * config/ia64/sysv4.h (TARGET_INIT_LIBFUNCS): New. Defined as + ia64_sysv4_init_libfuncs. + 2004-05-20 Falk Hueffner PR other/15526 diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index e15a8a7c8d5..6e3075de421 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -265,6 +265,8 @@ static void ia64_init_libfuncs (void) ATTRIBUTE_UNUSED; static void ia64_hpux_init_libfuncs (void) ATTRIBUTE_UNUSED; +static void ia64_sysv4_init_libfuncs (void) + ATTRIBUTE_UNUSED; static void ia64_vms_init_libfuncs (void) ATTRIBUTE_UNUSED; @@ -1671,7 +1673,7 @@ ia64_expand_compare (enum rtx_code code, enum machine_mode mode) /* HPUX TFmode compare requires a library call to _U_Qfcmp, which takes a magic number as its third argument, that indicates what to do. The return value is an integer to be compared against zero. */ - else if (TARGET_HPUX && GET_MODE (op0) == TFmode) + else if (GET_MODE (op0) == TFmode) { enum qfcmp_magic { QCMP_INV = 1, /* Raise FP_INVALID on SNaN as a side effect. */ @@ -1682,7 +1684,7 @@ ia64_expand_compare (enum rtx_code code, enum machine_mode mode) } magic; enum rtx_code ncode; rtx ret, insns; - if (GET_MODE (op1) != TFmode) + if (!cmptf_libfunc || GET_MODE (op1) != TFmode) abort (); switch (code) { @@ -8743,7 +8745,9 @@ ia64_hpux_file_end (void) } /* Set SImode div/mod functions, init_integral_libfuncs only initializes - modes of word_mode and larger. */ + modes of word_mode and larger. Rename the TFmode libfuncs using the + HPUX conventions. __divtf3 is used for XFmode. We need to keep it for + backward compatibility. */ static void ia64_init_libfuncs (void) @@ -8752,6 +8756,27 @@ ia64_init_libfuncs (void) set_optab_libfunc (udiv_optab, SImode, "__udivsi3"); set_optab_libfunc (smod_optab, SImode, "__modsi3"); set_optab_libfunc (umod_optab, SImode, "__umodsi3"); + + 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 (neg_optab, TFmode, "_U_Qfneg"); + + set_conv_libfunc (sext_optab, TFmode, SFmode, "_U_Qfcnvff_sgl_to_quad"); + set_conv_libfunc (sext_optab, TFmode, DFmode, "_U_Qfcnvff_dbl_to_quad"); + set_conv_libfunc (sext_optab, TFmode, XFmode, "_U_Qfcnvff_f80_to_quad"); + set_conv_libfunc (trunc_optab, SFmode, TFmode, "_U_Qfcnvff_quad_to_sgl"); + set_conv_libfunc (trunc_optab, DFmode, TFmode, "_U_Qfcnvff_quad_to_dbl"); + set_conv_libfunc (trunc_optab, XFmode, TFmode, "_U_Qfcnvff_quad_to_f80"); + + set_conv_libfunc (sfix_optab, SImode, TFmode, "_U_Qfcnvfxt_quad_to_sgl"); + set_conv_libfunc (sfix_optab, DImode, TFmode, "_U_Qfcnvfxt_quad_to_dbl"); + set_conv_libfunc (ufix_optab, SImode, TFmode, "_U_Qfcnvfxut_quad_to_sgl"); + set_conv_libfunc (ufix_optab, DImode, TFmode, "_U_Qfcnvfxut_quad_to_dbl"); + + set_conv_libfunc (sfloat_optab, TFmode, SImode, "_U_Qfcnvxf_sgl_to_quad"); + set_conv_libfunc (sfloat_optab, TFmode, DImode, "_U_Qfcnvxf_dbl_to_quad"); } /* Rename all the TFmode libfuncs using the HPUX conventions. */ @@ -8761,14 +8786,9 @@ ia64_hpux_init_libfuncs (void) { ia64_init_libfuncs (); - 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_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"); /* ia64_expand_compare uses this. */ cmptf_libfunc = init_one_libfunc ("_U_Qfcmp"); @@ -8780,21 +8800,6 @@ ia64_hpux_init_libfuncs (void) set_optab_libfunc (ge_optab, TFmode, 0); set_optab_libfunc (lt_optab, TFmode, 0); set_optab_libfunc (le_optab, TFmode, 0); - - set_conv_libfunc (sext_optab, TFmode, SFmode, "_U_Qfcnvff_sgl_to_quad"); - set_conv_libfunc (sext_optab, TFmode, DFmode, "_U_Qfcnvff_dbl_to_quad"); - set_conv_libfunc (sext_optab, TFmode, XFmode, "_U_Qfcnvff_f80_to_quad"); - set_conv_libfunc (trunc_optab, SFmode, TFmode, "_U_Qfcnvff_quad_to_sgl"); - set_conv_libfunc (trunc_optab, DFmode, TFmode, "_U_Qfcnvff_quad_to_dbl"); - set_conv_libfunc (trunc_optab, XFmode, TFmode, "_U_Qfcnvff_quad_to_f80"); - - set_conv_libfunc (sfix_optab, SImode, TFmode, "_U_Qfcnvfxt_quad_to_sgl"); - set_conv_libfunc (sfix_optab, DImode, TFmode, "_U_Qfcnvfxt_quad_to_dbl"); - set_conv_libfunc (ufix_optab, SImode, TFmode, "_U_Qfcnvfxut_quad_to_sgl"); - set_conv_libfunc (ufix_optab, DImode, TFmode, "_U_Qfcnvfxut_quad_to_dbl"); - - set_conv_libfunc (sfloat_optab, TFmode, SImode, "_U_Qfcnvxf_sgl_to_quad"); - set_conv_libfunc (sfloat_optab, TFmode, DImode, "_U_Qfcnvxf_dbl_to_quad"); } /* Rename the division and modulus functions in VMS. */ @@ -8811,6 +8816,28 @@ ia64_vms_init_libfuncs (void) set_optab_libfunc (umod_optab, SImode, "OTS$REM_UI"); set_optab_libfunc (umod_optab, DImode, "OTS$REM_UL"); } + +/* Rename the TFmode libfuncs available from soft-fp in glibc using + the HPUX conventions. */ + +static void +ia64_sysv4_init_libfuncs (void) +{ + ia64_init_libfuncs (); + + /* These functions are not part of the HPUX TFmode interface. We + use them instead of _U_Qfcmp, which doesn't work the way we + expect. */ + set_optab_libfunc (eq_optab, TFmode, "_U_Qfeq"); + set_optab_libfunc (ne_optab, TFmode, "_U_Qfne"); + set_optab_libfunc (gt_optab, TFmode, "_U_Qfgt"); + set_optab_libfunc (ge_optab, TFmode, "_U_Qfge"); + set_optab_libfunc (lt_optab, TFmode, "_U_Qflt"); + set_optab_libfunc (le_optab, TFmode, "_U_Qfle"); + + /* We leave out _U_Qfmin, _U_Qfmax and _U_Qfabs since soft-fp in + glibc doesn't have them. */ +} /* 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/ia64/sysv4.h b/gcc/config/ia64/sysv4.h index 15a57d924cd..69c24240948 100644 --- a/gcc/config/ia64/sysv4.h +++ b/gcc/config/ia64/sysv4.h @@ -1,5 +1,8 @@ /* Override definitions in elfos.h/svr4.h to be correct for IA64. */ +#undef TARGET_INIT_LIBFUNCS +#define TARGET_INIT_LIBFUNCS ia64_sysv4_init_libfuncs + /* We want DWARF2 as specified by the IA64 ABI. */ #undef PREFERRED_DEBUGGING_TYPE #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG -- 2.30.2