Patchwork [9/9,ARM] Remove artificial doloop_end pattern

login
register
mail settings
Submitter zhroma@ispras.ru
Date July 21, 2011, 4:30 p.m.
Message ID <1311265834-2144-10-git-send-email-zhroma@ispras.ru>
Download mbox | patch
Permalink /patch/106103/
State New
Headers show

Comments

zhroma@ispras.ru - July 21, 2011, 4:30 p.m.
This patch eliminates fake doloop_end pattern for ARM platform.  The problem
with such a pattern is that it slows down the loop when SMS doesn't create good
schedule.  So, i suppose fake pattern is no longer needed with new loop forms
supported.

2011-07-20  Roman Zhuykov  <zhroma@ispras.ru>
	* config/arm/thumb2.md (doloop_end): Delete.
---
 gcc/config/arm/thumb2.md |   51 ----------------------------------------------
 1 files changed, 0 insertions(+), 51 deletions(-)
Richard Earnshaw - Jan. 4, 2012, 4:47 p.m.
On 21/07/11 17:30, zhroma@ispras.ru wrote:
> This patch eliminates fake doloop_end pattern for ARM platform.  The problem
> with such a pattern is that it slows down the loop when SMS doesn't create good
> schedule.  So, i suppose fake pattern is no longer needed with new loop forms
> supported.
> 
> 2011-07-20  Roman Zhuykov  <zhroma@ispras.ru>
> 	* config/arm/thumb2.md (doloop_end): Delete.

I have no objections to this patch, but committing it needs to be
co-ordinated with the other SMS changes that are being discussed.
Deleting it today will, I think, cause SMS to be disabled and I don't
want that to happen.

R.

> ---
>  gcc/config/arm/thumb2.md |   51 ----------------------------------------------
>  1 files changed, 0 insertions(+), 51 deletions(-)
> 
> diff --git a/gcc/config/arm/thumb2.md b/gcc/config/arm/thumb2.md
> index 9a11012..492e765 100644
> --- a/gcc/config/arm/thumb2.md
> +++ b/gcc/config/arm/thumb2.md
> @@ -1101,54 +1101,3 @@
>    operands[2] = GEN_INT (32 - INTVAL (operands[2]));
>    ")
>  
> -;; Define the subtract-one-and-jump insns so loop.c
> -;; knows what to generate.
> -(define_expand "doloop_end"
> -  [(use (match_operand 0 "" ""))      ; loop pseudo
> -   (use (match_operand 1 "" ""))      ; iterations; zero if unknown
> -   (use (match_operand 2 "" ""))      ; max iterations
> -   (use (match_operand 3 "" ""))      ; loop level
> -   (use (match_operand 4 "" ""))]     ; label
> -  "TARGET_32BIT"
> -  "
> - {
> -   /* Currently SMS relies on the do-loop pattern to recognize loops
> -      where (1) the control part consists of all insns defining and/or
> -      using a certain 'count' register and (2) the loop count can be
> -      adjusted by modifying this register prior to the loop.
> -      ??? The possible introduction of a new block to initialize the
> -      new IV can potentially affect branch optimizations.  */
> -   if (optimize > 0 && flag_modulo_sched)
> -   {
> -     rtx s0;
> -     rtx bcomp;
> -     rtx loc_ref;
> -     rtx cc_reg;
> -     rtx insn;
> -     rtx cmp;
> -
> -     /* Only use this on innermost loops.  */
> -     if (INTVAL (operands[3]) > 1)
> -       FAIL;
> -
> -     if (GET_MODE (operands[0]) != SImode)
> -       FAIL;
> -
> -     s0 = operands [0];
> -     if (TARGET_THUMB2)
> -       insn = emit_insn (gen_thumb2_addsi3_compare0 (s0, s0, GEN_INT (-1)));
> -     else
> -       insn = emit_insn (gen_addsi3_compare0 (s0, s0, GEN_INT (-1)));
> -
> -     cmp = XVECEXP (PATTERN (insn), 0, 0);
> -     cc_reg = SET_DEST (cmp);
> -     bcomp = gen_rtx_NE (VOIDmode, cc_reg, const0_rtx);
> -     loc_ref = gen_rtx_LABEL_REF (VOIDmode, operands [4]);
> -     emit_jump_insn (gen_rtx_SET (VOIDmode, pc_rtx,
> -                                  gen_rtx_IF_THEN_ELSE (VOIDmode, bcomp,
> -                                                        loc_ref, pc_rtx)));
> -     DONE;
> -   }else
> -      FAIL;
> - }")
> -

Patch

diff --git a/gcc/config/arm/thumb2.md b/gcc/config/arm/thumb2.md
index 9a11012..492e765 100644
--- a/gcc/config/arm/thumb2.md
+++ b/gcc/config/arm/thumb2.md
@@ -1101,54 +1101,3 @@ 
   operands[2] = GEN_INT (32 - INTVAL (operands[2]));
   ")
 
-;; Define the subtract-one-and-jump insns so loop.c
-;; knows what to generate.
-(define_expand "doloop_end"
-  [(use (match_operand 0 "" ""))      ; loop pseudo
-   (use (match_operand 1 "" ""))      ; iterations; zero if unknown
-   (use (match_operand 2 "" ""))      ; max iterations
-   (use (match_operand 3 "" ""))      ; loop level
-   (use (match_operand 4 "" ""))]     ; label
-  "TARGET_32BIT"
-  "
- {
-   /* Currently SMS relies on the do-loop pattern to recognize loops
-      where (1) the control part consists of all insns defining and/or
-      using a certain 'count' register and (2) the loop count can be
-      adjusted by modifying this register prior to the loop.
-      ??? The possible introduction of a new block to initialize the
-      new IV can potentially affect branch optimizations.  */
-   if (optimize > 0 && flag_modulo_sched)
-   {
-     rtx s0;
-     rtx bcomp;
-     rtx loc_ref;
-     rtx cc_reg;
-     rtx insn;
-     rtx cmp;
-
-     /* Only use this on innermost loops.  */
-     if (INTVAL (operands[3]) > 1)
-       FAIL;
-
-     if (GET_MODE (operands[0]) != SImode)
-       FAIL;
-
-     s0 = operands [0];
-     if (TARGET_THUMB2)
-       insn = emit_insn (gen_thumb2_addsi3_compare0 (s0, s0, GEN_INT (-1)));
-     else
-       insn = emit_insn (gen_addsi3_compare0 (s0, s0, GEN_INT (-1)));
-
-     cmp = XVECEXP (PATTERN (insn), 0, 0);
-     cc_reg = SET_DEST (cmp);
-     bcomp = gen_rtx_NE (VOIDmode, cc_reg, const0_rtx);
-     loc_ref = gen_rtx_LABEL_REF (VOIDmode, operands [4]);
-     emit_jump_insn (gen_rtx_SET (VOIDmode, pc_rtx,
-                                  gen_rtx_IF_THEN_ELSE (VOIDmode, bcomp,
-                                                        loc_ref, pc_rtx)));
-     DONE;
-   }else
-      FAIL;
- }")
-