Does unrolling prevents doloop optimizations?

Vladimir Yanovsky volodyan@gmail.com
Tue Jun 12 12:37:00 GMT 2007


Thanks,

To make sure I understood you correctly, does it mean that the change
(below in /* */) in doloop_condition_get is safe?

  /* We expect a GE or NE comparison with 0 or 1.  */
  if (/*(GET_CODE (condition) != GE
       && GET_CODE (condition) != NE)
      ||*/ (XEXP (condition, 1) != const0_rtx
          && XEXP (condition, 1) != const1_rtx))
    return 0;

Thanks,
Vladimir


On 6/12/07, Zdenek Dvorak <rakdver@kam.mff.cuni.cz> wrote:
> Hello,
>
> > In file loop_doloop.c function doloop_condition_get makes sure that
> > the condition is GE or NE
> > otherwise it prevents doloop optimizations. This caused a problem for
> > a loop which had NE condition without unrolling and EQ if unrolling
> > was run.
>
> actually, doloop_condition_get is not applied to the code of the
> program, so this change is irrelevant (doloop_condition_get is applied
> to the doloop pattern from the machine description).  So there must be
> some other reason why doloop transformation is not applied for your
> loop.
>
> Zdenek
>
> > Can I make doloop work after the unroller?
> >
> > Thanks,
> > Vladimir
> >
> > ----------------------------------------------------------------------------------------
> > Without unrolling:
> > (insn 135 80 136 4 (set (reg:SI 204 [ LastIndex ])
> >        (plus:SI (reg:SI 204 [ LastIndex ])
> >            (const_int -1 [0xffffffffffffffff]))) 51 {addsi3} (nil)
> >    (nil))
> >
> > (jump_insn 136 135 84 4 (set (pc)
> >        (if_then_else (ne:SI (reg:SI 204 [ LastIndex ])
> >                (const_int 0 [0x0]))
> >            (label_ref:SI 69)
> >            (pc))) 368 {*spu.md:3288} (insn_list:REG_DEP_TRUE 135 (nil))
> >    (expr_list:REG_BR_PROB (const_int 9000 [0x2328])
> >        (nil)))
> >
> >
> > After unrolling:
> > (insn 445 421 446 21 (set (reg:SI 213)
> >        (plus:SI (reg:SI 213)
> >            (const_int -1 [0xffffffffffffffff]))) 51 {addsi3} (nil)
> >    (nil))
> >
> > (jump_insn 446 445 667 21 (set (pc)
> >        (if_then_else (eq:SI (reg:SI 213)
> >                (const_int 0 [0x0]))
> >            (label_ref:SI 465)
> >            (pc))) 368 {*spu.md:3288} (insn_list:REG_DEP_TRUE 445 (nil))
> >    (expr_list:REG_BR_PROB (const_int 1000 [0x3e8])
> >        (nil)))
>



More information about the Gcc mailing list