aboutsummaryrefslogtreecommitdiff
path: root/gcc/loop.c
diff options
context:
space:
mode:
authorRoger Sayle <roger@eyesopen.com>2003-11-09 14:33:20 +0000
committerRoger Sayle <sayle@gcc.gnu.org>2003-11-09 14:33:20 +0000
commitce4191eed16e15397cc09bba95d8ef603ba05359 (patch)
treec993edb42c75d10e8adc5feee8d68fa2f583bc7e /gcc/loop.c
parent8b93ca2dd22f8e6d2c3a5ab70d5d79c6ee6b665a (diff)
downloadgcc-ce4191eed16e15397cc09bba95d8ef603ba05359.zip
gcc-ce4191eed16e15397cc09bba95d8ef603ba05359.tar.gz
gcc-ce4191eed16e15397cc09bba95d8ef603ba05359.tar.bz2
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
Diffstat (limited to 'gcc/loop.c')
-rw-r--r--gcc/loop.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/loop.c b/gcc/loop.c
index 667833d..159906d 100644
--- a/gcc/loop.c
+++ b/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;