From: Jeffrey A Law Date: Wed, 30 Sep 1998 17:32:15 +0000 (+0000) Subject: loop.c (check_dbra_loop): Use a vanilla loop reversal if the biv is used to compute... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c5cbf81ecfef4b9a54e05a26d1ca9c37cb012a32;p=gcc.git loop.c (check_dbra_loop): Use a vanilla loop reversal if the biv is used to compute a giv or as some... * loop.c (check_dbra_loop): Use a vanilla loop reversal if the biv is used to compute a giv or as some other non-counting use. From-SVN: r22684 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5e224d71828..81faece302f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +Wed Sep 30 18:29:26 1998 Jeffrey A Law (law@cygnus.com) + + * loop.c (check_dbra_loop): Use a vanilla loop reversal if the biv is + used to compute a giv or as some other non-counting use. + Wed Sep 30 18:19:27 1998 Michael Hayes * regs.h (HARD_REGNO_CALLER_SAVE_MODE): New macro. diff --git a/gcc/loop.c b/gcc/loop.c index 0a6cf059b44..f8e4d8d06b9 100644 --- a/gcc/loop.c +++ b/gcc/loop.c @@ -6992,9 +6992,13 @@ check_dbra_loop (loop_end, insn_count, loop_start) if (initial_value == const0_rtx /* If we have a decrement_and_branch_on_count, prefer the NE test, since this will allow that instruction to - be generated. */ + be generated. Note that we must use a vanilla loop + reversal if the biv is used to calculate a giv or has + a non-counting use. */ #if ! defined (HAVE_decrement_and_branch_until_zero) && defined (HAVE_decrement_and_branch_on_count) - && (add_val != 1 || ! vtop) + && (! (add_val == 1 && vtop + && (bl->biv_count == 0 + || no_use_except_counting))) #endif && GET_CODE (comparison_value) == CONST_INT /* Now do postponed overflow checks on COMPARISON_VAL. */ @@ -7007,7 +7011,9 @@ check_dbra_loop (loop_end, insn_count, loop_start) nonneg = 1; cmp_code = GE; } - else if (add_val == 1 && vtop) + else if (add_val == 1 && vtop + && (bl->biv_count == 0 + || no_use_except_counting)) { add_adjust = 0; cmp_code = NE;