loop.c (check_dbra_loop): Try swapping the comparison operands of the loop condition to identify a...
* loop.c (check_dbra_loop): Try swapping the comparison operands of the loop condition to identify a suitable induction variable. * unroll.c (loop_iterations): Likewise. From-SVN: r73391
This commit is contained in:
parent
8b93ca2dd2
commit
ce4191eed1
3 changed files with 36 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
|||
2003-11-09 Roger Sayle <roger@eyesopen.com>
|
||||
|
||||
* loop.c (check_dbra_loop): Try swapping the comparison operands
|
||||
of the loop condition to identify a suitable induction variable.
|
||||
* unroll.c (loop_iterations): Likewise.
|
||||
|
||||
2003-11-09 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||
|
||||
* config/sparc/sparc.h (TARGET_CPU_CPP_BUILTINS): Fix sparc vs
|
||||
|
|
16
gcc/loop.c
16
gcc/loop.c
|
@ -8017,6 +8017,22 @@ check_dbra_loop (struct loop *loop, int insn_count)
|
|||
break;
|
||||
}
|
||||
|
||||
/* Try swapping the comparison to identify a suitable biv. */
|
||||
if (!bl)
|
||||
for (bl = ivs->list; bl; bl = bl->next)
|
||||
if (bl->biv_count == 1
|
||||
&& ! bl->biv->maybe_multiple
|
||||
&& bl->biv->dest_reg == XEXP (comparison, 1)
|
||||
&& ! reg_used_between_p (regno_reg_rtx[bl->regno], bl->biv->insn,
|
||||
first_compare))
|
||||
{
|
||||
comparison = gen_rtx_fmt_ee (swap_condition (GET_CODE (comparison)),
|
||||
VOIDmode,
|
||||
XEXP (comparison, 1),
|
||||
XEXP (comparison, 0));
|
||||
break;
|
||||
}
|
||||
|
||||
if (! bl)
|
||||
return 0;
|
||||
|
||||
|
|
15
gcc/unroll.c
15
gcc/unroll.c
|
@ -3421,7 +3421,20 @@ loop_iterations (struct loop *loop)
|
|||
"Loop iterations: Iteration var not an integer.\n");
|
||||
return 0;
|
||||
}
|
||||
else if (REG_IV_TYPE (ivs, REGNO (iteration_var)) == BASIC_INDUCT)
|
||||
|
||||
/* Try swapping the comparison to identify a suitable iv. */
|
||||
if (REG_IV_TYPE (ivs, REGNO (iteration_var)) != BASIC_INDUCT
|
||||
&& REG_IV_TYPE (ivs, REGNO (iteration_var)) != GENERAL_INDUCT
|
||||
&& GET_CODE (comparison_value) == REG
|
||||
&& REGNO (comparison_value) < ivs->n_regs)
|
||||
{
|
||||
rtx temp = comparison_value;
|
||||
comparison_code = swap_condition (comparison_code);
|
||||
comparison_value = iteration_var;
|
||||
iteration_var = temp;
|
||||
}
|
||||
|
||||
if (REG_IV_TYPE (ivs, REGNO (iteration_var)) == BASIC_INDUCT)
|
||||
{
|
||||
if (REGNO (iteration_var) >= ivs->n_regs)
|
||||
abort ();
|
||||
|
|
Loading…
Add table
Reference in a new issue