diff options
author | Richard Sandiford <rdsandiford@googlemail.com> | 2013-11-09 11:42:16 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2013-11-09 11:42:16 +0000 |
commit | 1d0216c8b79931cffcc5599b8a9a4f6eaf86d2b7 (patch) | |
tree | 5b96e2c7a588193d1b4019f9316a1ca13b8376ce /gcc/config/arc | |
parent | 12929715b124071e523316c28897c8a05083cf12 (diff) | |
download | gcc-1d0216c8b79931cffcc5599b8a9a4f6eaf86d2b7.zip gcc-1d0216c8b79931cffcc5599b8a9a4f6eaf86d2b7.tar.gz gcc-1d0216c8b79931cffcc5599b8a9a4f6eaf86d2b7.tar.bz2 |
target.def (can_use_doloop_p): New hook.
gcc/
* target.def (can_use_doloop_p): New hook.
* doc/tm.texi.in (TARGET_CAN_USE_DOLOOP_P): Add.
* doc/tm.texi: Regenerate.
* doc/md.texi (doloop_begin, doloop_end): Update documentation.
* hooks.h (hook_bool_dint_dint_uint_true): Declare.
* hooks.c (hook_bool_dint_dint_uint_true): New function.
* targhooks.h (can_use_doloop_if_innermost): Declare.
* targhooks.c (can_use_doloop_if_innermost): New function.
* target.h: Include double-int.h.
* loop-doloop.c (doloop_optimize): Call targetm.can_use_doloop_p.
Remove iteration count, maximum iteration count, loop depth and
enter-at-top inputs from doloop_begin and doloop_end.
* config/arc/arc.md (doloop_begin, doloop_end): Update for new
interface.
* config/arc/arc.c (arc_can_use_doloop_p): New function.
(TARGET_CAN_USE_DOLOOP_P): Define.
* config/arm/thumb2.md (doloop_end): Update for new interface.
* config/arm/arm.c (TARGET_CAN_USE_DOLOOP_P): Define.
* config/bfin/bfin.md (doloop_end): Update for new interface.
* config/bfin/bfin.c (bfin_can_use_doloop_p): New function.
(TARGET_CAN_USE_DOLOOP_P): Define.
* config/c6x/c6x.md (doloop_end): Update for new interface.
* config/ia64/ia64.md (doloop_end): Update for new interface.
* config/ia64/ia64.c (TARGET_CAN_USE_DOLOOP_P): Define.
* config/mep/mep.md (doloop_begin, doloop_end): Update for new
interface.
* config/mep/mep.c (mep_emit_doloop): Likewise.
(TARGET_CAN_USE_DOLOOP_P): Define.
* config/rs6000/rs6000.md (doloop_end): Update for new interface.
* config/rs6000/rs6000.c (TARGET_CAN_USE_DOLOOP_P): Define.
* config/s390/s390.md (doloop_end): Update for new interface.
* config/sh/sh.md (doloop_end): Likewise.
* config/spu/spu.md (doloop_end): Likewise.
* config/spu/spu.c (TARGET_CAN_USE_DOLOOP_P): Define.
* config/tilegx/tilegx.md (doloop_end): Update for new interface.
* config/tilegx/tilegx.c (TARGET_CAN_USE_DOLOOP_P): Define.
* config/tilepro/tilepro.md (doloop_end): Update for new interface.
* config/tilepro/tilepro.c (TARGET_CAN_USE_DOLOOP_P): Define.
* config/v850/v850.md (doloop_begin, doloop_end): Update for new
interface.
* config/v850/v850.c (TARGET_CAN_USE_DOLOOP_P): Define.
From-SVN: r204614
Diffstat (limited to 'gcc/config/arc')
-rw-r--r-- | gcc/config/arc/arc.c | 21 | ||||
-rw-r--r-- | gcc/config/arc/arc.md | 34 |
2 files changed, 27 insertions, 28 deletions
diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c index 1e0c25e..7b1853b 100644 --- a/gcc/config/arc/arc.c +++ b/gcc/config/arc/arc.c @@ -388,6 +388,7 @@ static bool arc_return_in_memory (const_tree, const_tree); static void arc_init_simd_builtins (void); static bool arc_vector_mode_supported_p (enum machine_mode); +static bool arc_can_use_doloop_p (double_int, double_int, unsigned int, bool); static const char *arc_invalid_within_doloop (const_rtx); static void output_short_suffix (FILE *file); @@ -493,6 +494,9 @@ static void arc_finalize_pic (void); #undef TARGET_VECTOR_MODE_SUPPORTED_P #define TARGET_VECTOR_MODE_SUPPORTED_P arc_vector_mode_supported_p +#undef TARGET_CAN_USE_DOLOOP_P +#define TARGET_CAN_USE_DOLOOP_P arc_can_use_doloop_p + #undef TARGET_INVALID_WITHIN_DOLOOP #define TARGET_INVALID_WITHIN_DOLOOP arc_invalid_within_doloop @@ -5638,6 +5642,23 @@ arc_pass_by_reference (cumulative_args_t ca_v ATTRIBUTE_UNUSED, || TREE_ADDRESSABLE (type))); } +/* Implement TARGET_CAN_USE_DOLOOP_P. */ + +static bool +arc_can_use_doloop_p (double_int iterations, double_int, + unsigned int loop_depth, bool entered_at_top) +{ + if (loop_depth > 1) + return false; + /* Setting up the loop with two sr instructions costs 6 cycles. */ + if (TARGET_ARC700 + && !entered_at_top + && iterations.high == 0 + && iterations.low > 0 + && iterations.low <= (flag_pic ? 6 : 3)) + return false; + return true; +} /* NULL if INSN insn is valid within a low-overhead loop. Otherwise return why doloop cannot be applied. */ diff --git a/gcc/config/arc/arc.md b/gcc/config/arc/arc.md index aa8243a..baf3478 100644 --- a/gcc/config/arc/arc.md +++ b/gcc/config/arc/arc.md @@ -4706,16 +4706,10 @@ }) ; operand 0 is the loop count pseudo register -; operand 1 is the number of loop iterations or 0 if it is unknown -; operand 2 is the maximum number of loop iterations -; operand 3 is the number of levels of enclosed loops -; operand 4 is the loop end pattern +; operand 1 is the loop end pattern (define_expand "doloop_begin" [(use (match_operand 0 "register_operand" "")) - (use (match_operand:QI 1 "const_int_operand" "")) - (use (match_operand:QI 2 "const_int_operand" "")) - (use (match_operand:QI 3 "const_int_operand" "")) - (use (match_operand 4 "" ""))] + (use (match_operand 1 "" ""))] "" { /* Using the INSN_UID of the loop end pattern to identify it causes @@ -4725,10 +4719,8 @@ still be able to tell what kind of number this is. */ static HOST_WIDE_INT loop_end_id = 0; - if (INTVAL (operands[3]) > 1) - FAIL; rtx id = GEN_INT (--loop_end_id); - XEXP (XVECEXP (PATTERN (operands[4]), 0, 4), 0) = id; + XEXP (XVECEXP (PATTERN (operands[1]), 0, 4), 0) = id; emit_insn (gen_doloop_begin_i (operands[0], const0_rtx, id, const0_rtx, const0_rtx)); DONE; @@ -4907,11 +4899,7 @@ ) ; operand 0 is the loop count pseudo register -; operand 1 is the number of loop iterations or 0 if it is unknown -; operand 2 is the maximum number of loop iterations -; operand 3 is the number of levels of enclosed loops -; operand 4 is the label to jump to at the top of the loop -; operand 5 is nonzero if the loop is entered at its top. +; operand 1 is the label to jump to at the top of the loop ; Use this for the ARC600 and ARC700. For ARCtangent-A5, this is unsafe ; without further checking for nearby branches etc., and without proper ; annotation of shift patterns that clobber lp_count @@ -4919,24 +4907,14 @@ ; single insn - loop setup is expensive then. (define_expand "doloop_end" [(use (match_operand 0 "register_operand" "")) - (use (match_operand:QI 1 "const_int_operand" "")) - (use (match_operand:QI 2 "const_int_operand" "")) - (use (match_operand:QI 3 "const_int_operand" "")) - (use (label_ref (match_operand 4 "" ""))) - (use (match_operand:QI 5 "const_int_operand" ""))] + (use (label_ref (match_operand 1 "" "")))] "TARGET_ARC600 || TARGET_ARC700" { - if (INTVAL (operands[3]) > 1) - FAIL; - /* Setting up the loop with two sr isntructions costs 6 cycles. */ - if (TARGET_ARC700 && !INTVAL (operands[5]) - && INTVAL (operands[1]) && INTVAL (operands[1]) <= (flag_pic ? 6 : 3)) - FAIL; /* We could do smaller bivs with biv widening, and wider bivs by having a high-word counter in an outer loop - but punt on this for now. */ if (GET_MODE (operands[0]) != SImode) FAIL; - emit_jump_insn (gen_doloop_end_i (operands[0], operands[4], const0_rtx)); + emit_jump_insn (gen_doloop_end_i (operands[0], operands[1], const0_rtx)); DONE; }) |