From 4fda2521e9a1b2062c07df7f26c8b49adf036833 Mon Sep 17 00:00:00 2001 From: "Herman A.J. ten Brugge" Date: Sat, 29 Jan 2000 04:11:21 +0100 Subject: [PATCH] c4x.h (INIT_TARGET_OPTABS): Add all missing local optab entries. 2000-01-29 Herman A.J. ten Brugge * c4x.h (INIT_TARGET_OPTABS): Add all missing local optab entries. * c4x.c: Define the optab rtx values. (c4x_add_gc_roots): Add the ggc roots for these optab rtx values. (c4x_emit_libcall): Use new optab rtx values. (c4x_emit_libcall3): Likewise. (c4x_emit_libcall_mulhi): Likewise. * c4x-protos.h: Add prototypes for optab rtx values and change prototypes for above c4x_emit_libcall functions. From-SVN: r31683 --- gcc/ChangeLog | 11 +++++++++ gcc/config/c4x/c4x-protos.h | 17 +++++++++++--- gcc/config/c4x/c4x.c | 46 ++++++++++++++++++++++++------------- gcc/config/c4x/c4x.h | 21 ++++++++++++++++- gcc/config/c4x/c4x.md | 26 +++++++++++---------- 5 files changed, 89 insertions(+), 32 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cbd335ba1c8..abf652ad751 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2000-01-29 Herman A.J. ten Brugge + + * c4x.h (INIT_TARGET_OPTABS): Add all missing local optab entries. + * c4x.c: Define the optab rtx values. + (c4x_add_gc_roots): Add the ggc roots for these optab rtx values. + (c4x_emit_libcall): Use new optab rtx values. + (c4x_emit_libcall3): Likewise. + (c4x_emit_libcall_mulhi): Likewise. + * c4x-protos.h: Add prototypes for optab rtx values and change + prototypes for above c4x_emit_libcall functions. + 2000-01-29 Herman A.J. ten Brugge * c4x.c (c4x_output_ascii): Restrict line length of output when TI diff --git a/gcc/config/c4x/c4x-protos.h b/gcc/config/c4x/c4x-protos.h index f5ebd16dcb0..810c05224dd 100644 --- a/gcc/config/c4x/c4x-protos.h +++ b/gcc/config/c4x/c4x-protos.h @@ -226,14 +226,14 @@ extern int c4x_T_constraint PARAMS ((rtx)); extern int c4x_U_constraint PARAMS ((rtx)); -extern void c4x_emit_libcall PARAMS ((const char *, enum rtx_code, +extern void c4x_emit_libcall PARAMS ((rtx, enum rtx_code, enum machine_mode, enum machine_mode, int, rtx *)); -extern void c4x_emit_libcall3 PARAMS ((const char *, enum rtx_code, +extern void c4x_emit_libcall3 PARAMS ((rtx, enum rtx_code, enum machine_mode, rtx *)); -extern void c4x_emit_libcall_mulhi PARAMS ((char *, enum rtx_code, +extern void c4x_emit_libcall_mulhi PARAMS ((rtx, enum rtx_code, enum machine_mode, rtx *)); extern int c4x_emit_move_sequence PARAMS ((rtx *, enum machine_mode)); @@ -251,5 +251,16 @@ extern int valid_parallel_operands_5 PARAMS ((rtx *, enum machine_mode)); extern int valid_parallel_operands_6 PARAMS ((rtx *, enum machine_mode)); +extern rtx smulhi3_libfunc; +extern rtx umulhi3_libfunc; +extern rtx fix_truncqfhi2_libfunc; +extern rtx fixuns_truncqfhi2_libfunc; +extern rtx fix_trunchfhi2_libfunc; +extern rtx fixuns_trunchfhi2_libfunc; +extern rtx floathiqf2_libfunc; +extern rtx floatunshiqf2_libfunc; +extern rtx floathihf2_libfunc; +extern rtx floatunshihf2_libfunc; + #endif /* RTX_CODE */ diff --git a/gcc/config/c4x/c4x.c b/gcc/config/c4x/c4x.c index 5072d234a53..e0051ea8f40 100644 --- a/gcc/config/c4x/c4x.c +++ b/gcc/config/c4x/c4x.c @@ -46,6 +46,17 @@ #include "ggc.h" #include "c4x-protos.h" +rtx smulhi3_libfunc; +rtx umulhi3_libfunc; +rtx fix_truncqfhi2_libfunc; +rtx fixuns_truncqfhi2_libfunc; +rtx fix_trunchfhi2_libfunc; +rtx fixuns_trunchfhi2_libfunc; +rtx floathiqf2_libfunc; +rtx floatunshiqf2_libfunc; +rtx floathihf2_libfunc; +rtx floatunshihf2_libfunc; + static int c4x_leaf_function; static char *float_reg_names[] = FLOAT_REGISTER_NAMES; @@ -163,6 +174,16 @@ c4x_add_gc_roots () ggc_add_tree_root (&pure_tree, 1); ggc_add_tree_root (&noreturn_tree, 1); ggc_add_tree_root (&interrupt_tree, 1); + ggc_add_rtx_root (&smulhi3_libfunc, 1); + ggc_add_rtx_root (&umulhi3_libfunc, 1); + ggc_add_rtx_root (&fix_truncqfhi2_libfunc, 1); + ggc_add_rtx_root (&fixuns_truncqfhi2_libfunc, 1); + ggc_add_rtx_root (&fix_trunchfhi2_libfunc, 1); + ggc_add_rtx_root (&fixuns_trunchfhi2_libfunc, 1); + ggc_add_rtx_root (&floathiqf2_libfunc, 1); + ggc_add_rtx_root (&floatunshiqf2_libfunc, 1); + ggc_add_rtx_root (&floathihf2_libfunc, 1); + ggc_add_rtx_root (&floatunshihf2_libfunc, 1); } @@ -1237,8 +1258,8 @@ c4x_emit_move_sequence (operands, mode) void -c4x_emit_libcall (name, code, dmode, smode, noperands, operands) - const char *name; +c4x_emit_libcall (libcall, code, dmode, smode, noperands, operands) + rtx libcall; enum rtx_code code; enum machine_mode dmode; enum machine_mode smode; @@ -1247,13 +1268,9 @@ c4x_emit_libcall (name, code, dmode, smode, noperands, operands) { rtx ret; rtx insns; - rtx libcall; rtx equiv; start_sequence (); - if (ggc_p) - name = ggc_alloc_string (name, -1); - libcall = gen_rtx_SYMBOL_REF (Pmode, name); switch (noperands) { case 2: @@ -1279,30 +1296,28 @@ c4x_emit_libcall (name, code, dmode, smode, noperands, operands) void -c4x_emit_libcall3 (name, code, mode, operands) - const char *name; +c4x_emit_libcall3 (libcall, code, mode, operands) + rtx libcall; enum rtx_code code; enum machine_mode mode; rtx *operands; { - return c4x_emit_libcall (name, code, mode, mode, 3, operands); + return c4x_emit_libcall (libcall, code, mode, mode, 3, operands); } void -c4x_emit_libcall_mulhi (name, code, mode, operands) - char *name; +c4x_emit_libcall_mulhi (libcall, code, mode, operands) + rtx libcall; enum rtx_code code; enum machine_mode mode; rtx *operands; { rtx ret; rtx insns; - rtx libcall; rtx equiv; start_sequence (); - libcall = gen_rtx_SYMBOL_REF (Pmode, name); ret = emit_library_call_value (libcall, NULL_RTX, 1, mode, 2, operands[1], mode, operands[2], mode); equiv = gen_rtx_TRUNCATE (mode, @@ -2329,8 +2344,8 @@ c4x_shiftable_constant (op) break; } mask = ((0xffff >> i) << 16) | 0xffff; - if (IS_INT16_CONST (val & 0x80000000 ? (val >> i) | ~mask - : (val >> i) & mask)) + if (IS_INT16_CONST (val & (1 << 31) ? (val >> i) | ~mask + : (val >> i) & mask)) return i; return -1; } @@ -3000,7 +3015,6 @@ std_reg_operand (op, mode) return REG_P (op) && IS_STD_OR_PSEUDO_REG (op); } - /* Standard precision or normal register. */ int diff --git a/gcc/config/c4x/c4x.h b/gcc/config/c4x/c4x.h index 8c8e9818fcc..2a5bd618806 100644 --- a/gcc/config/c4x/c4x.h +++ b/gcc/config/c4x/c4x.h @@ -1462,7 +1462,6 @@ CUMULATIVE_ARGS; #define FFS_LIBCALL "__ffs" - #define INIT_TARGET_OPTABS \ do { \ smul_optab->handlers[(int) QImode].libfunc \ @@ -1493,6 +1492,26 @@ CUMULATIVE_ARGS; = 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 diff --git a/gcc/config/c4x/c4x.md b/gcc/config/c4x/c4x.md index 07608c1a6fd..e0b8f7e34a4 100644 --- a/gcc/config/c4x/c4x.md +++ b/gcc/config/c4x/c4x.md @@ -2084,7 +2084,8 @@ operands[2])); DONE; } - c4x_emit_libcall3 (MULQI3_LIBCALL, MULT, QImode, operands); + c4x_emit_libcall3 (smul_optab->handlers[(int) QImode].libfunc, + MULT, QImode, operands); DONE; } ") @@ -2295,7 +2296,7 @@ "legitimize_operands (MULT, operands, QImode); if (TARGET_C3X) { - c4x_emit_libcall_mulhi (SMULHI3_LIBCALL, SIGN_EXTEND, QImode, operands); + c4x_emit_libcall_mulhi (smulhi3_libfunc, SIGN_EXTEND, QImode, operands); DONE; } ") @@ -2352,7 +2353,7 @@ "legitimize_operands (MULT, operands, QImode); if (TARGET_C3X) { - c4x_emit_libcall_mulhi (UMULHI3_LIBCALL, ZERO_EXTEND, QImode, operands); + c4x_emit_libcall_mulhi (umulhi3_libfunc, ZERO_EXTEND, QImode, operands); DONE; } ") @@ -3747,7 +3748,7 @@ (fix:HI (match_operand:QF 1 "src_operand" ""))) (clobber (reg:CC 21))])] "" - "c4x_emit_libcall (FIX_TRUNCQFHI2_LIBCALL, FIX, HImode, QFmode, 2, operands); + "c4x_emit_libcall (fix_truncqfhi2_libfunc, FIX, HImode, QFmode, 2, operands); DONE;") ; Is this allowed to be implementation dependent? If so, we can @@ -3770,7 +3771,7 @@ (unsigned_fix:HI (match_operand:QF 1 "src_operand" ""))) (clobber (reg:CC 21))])] "" - "c4x_emit_libcall (FIXUNS_TRUNCQFHI2_LIBCALL, UNSIGNED_FIX, + "c4x_emit_libcall (fixuns_truncqfhi2_libfunc, UNSIGNED_FIX, HImode, QFmode, 2, operands); DONE;") @@ -5905,7 +5906,7 @@ (fix:HI (match_operand:HF 1 "reg_operand" ""))) (clobber (reg:CC 21))])] "" - "c4x_emit_libcall (FIX_TRUNCHFHI2_LIBCALL, FIX, HImode, HFmode, 2, operands); + "c4x_emit_libcall (fix_trunchfhi2_libfunc, FIX, HImode, HFmode, 2, operands); DONE;") (define_expand "fixuns_trunchfhi2" @@ -5913,7 +5914,7 @@ (unsigned_fix:HI (match_operand:HF 1 "reg_operand" ""))) (clobber (reg:CC 21))])] "" - "c4x_emit_libcall (FIXUNS_TRUNCHFHI2_LIBCALL, UNSIGNED_FIX, + "c4x_emit_libcall (fixuns_trunchfhi2_libfunc, UNSIGNED_FIX, HImode, HFmode, 2, operands); DONE;") @@ -6254,7 +6255,7 @@ (float:QF (match_operand:HI 1 "src_operand" ""))) (clobber (reg:CC 21))])] "" - "c4x_emit_libcall (FLOATHIQF2_LIBCALL, FLOAT, QFmode, HImode, 2, operands); + "c4x_emit_libcall (floathiqf2_libfunc, FLOAT, QFmode, HImode, 2, operands); DONE;") (define_expand "floatunshiqf2" @@ -6262,7 +6263,7 @@ (unsigned_float:QF (match_operand:HI 1 "src_operand" ""))) (clobber (reg:CC 21))])] "" - "c4x_emit_libcall (FLOATUNSHIQF2_LIBCALL, UNSIGNED_FLOAT, + "c4x_emit_libcall (floatunshiqf2_libfunc, UNSIGNED_FLOAT, QFmode, HImode, 2, operands); DONE;") @@ -6271,7 +6272,7 @@ (float:HF (match_operand:HI 1 "src_operand" ""))) (clobber (reg:CC 21))])] "" - "c4x_emit_libcall (FLOATHIHF2_LIBCALL, FLOAT, HFmode, HImode, 2, operands); + "c4x_emit_libcall (floathihf2_libfunc, FLOAT, HFmode, HImode, 2, operands); DONE;") (define_expand "floatunshihf2" @@ -6279,7 +6280,7 @@ (unsigned_float:HF (match_operand:HI 1 "src_operand" ""))) (clobber (reg:CC 21))])] "" - "c4x_emit_libcall (FLOATUNSHIHF2_LIBCALL, UNSIGNED_FLOAT, + "c4x_emit_libcall (floatunshihf2_libfunc, UNSIGNED_FLOAT, HFmode, HImode, 2, operands); DONE;") @@ -6846,7 +6847,8 @@ (match_operand:HI 2 "src_operand" ""))) (clobber (reg:CC 21))])] "" - "c4x_emit_libcall3 (MULHI3_LIBCALL, MULT, HImode, operands); + "c4x_emit_libcall3 (smul_optab->handlers[(int) HImode].libfunc, + MULT, HImode, operands); DONE;") -- 2.30.2