[PATCH] Modulo-scheduling improvements. Patch 2 of 2.

Zdenek Dvorak rakdver@kam.mff.cuni.cz
Fri Aug 17 15:40:00 GMT 2007


Hello,

loop-doloop.c part of the patch is OK with the following changes:

> +  pattern = PATTERN (doloop_pat);
> +
>    if (GET_CODE (pattern) != PARALLEL)
> -    return 0;
> +    {
> +      rtx cond;
>  
> -  cmp = XVECEXP (pattern, 0, 0);
> -  inc = XVECEXP (pattern, 0, 1);
> +      cmp = pattern;
> +      inc = PATTERN (PREV_INSN (doloop_pat));
> +      /* We expect the condition to be of the form (reg != 0)  */
> +      cond = XEXP (SET_SRC (cmp), 0);
> +      if (GET_CODE (cond) != NE || XEXP (cond, 1) != const0_rtx)
> +        return 0;
>  
> +    }
> +  else
> +    {
> +      cmp = XVECEXP (pattern, 0, 0);
> +      inc = XVECEXP (pattern, 0, 1);
> +    }
> +
>    /* Check for (set (reg) (something)).  */
>    if (GET_CODE (inc) != SET)
>      return 0;
> @@ -139,7 +157,13 @@
>    if ((XEXP (condition, 0) == reg)
>        || (GET_CODE (XEXP (condition, 0)) == PLUS
>  		   && XEXP (XEXP (condition, 0), 0) == reg))
> +   {
> +     if (GET_CODE (pattern) != PARALLEL)
> +     /* Generate (reg != 1) condition instead.  */

Replace this comment by an explanation why you do this.

> +        condition = gen_rtx_fmt_ee (NE, VOIDmode, inc_src, const1_rtx);
> +
>      return condition;
> +   }

> Index: config/spu/spu.md
> ===================================================================
> --- config/spu/spu.md	(revision 127390)
> +++ config/spu/spu.md	(working copy)
> @@ -3887,6 +3887,43 @@
>    [(set_attr "type" "br")])
>  
>  
> +
> + ;; 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
> +   ""
> +   "
> + {
> +   /* ??? Enable doloop only if -fmodulo-sched is set.  */

Add a comment explaining why you do this.

Zdenek



More information about the Gcc-patches mailing list