From 8ed69d0908630adcf3d385266d168f49d3ba1b5e Mon Sep 17 00:00:00 2001 From: "J\"orn Rennecke" Date: Fri, 28 Aug 1998 07:05:20 +0000 Subject: loop.c (check_dbra_loop): Fix calculation of FINAL_VALUE when COMPARISON_VAL was normalized. * loop.c (check_dbra_loop): Fix calculation of FINAL_VALUE when COMPARISON_VAL was normalized. From-SVN: r22051 --- gcc/ChangeLog | 5 +++++ gcc/loop.c | 12 +++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ae5ef3d..9341194 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +Fri Aug 28 14:54:07 1998 J"orn Rennecke + + * loop.c (check_dbra_loop): Fix calculation of FINAL_VALUE when + COMPARISON_VAL was normalized. + Thu Aug 27 20:10:46 1998 Jeffrey A Law (law@cygnus.com) * loop.c (check_dbra_loop): The loop ending comparison value diff --git a/gcc/loop.c b/gcc/loop.c index cd257be..e581f44 100644 --- a/gcc/loop.c +++ b/gcc/loop.c @@ -7004,11 +7004,18 @@ check_dbra_loop (loop_end, insn_count, loop_start) return 0; } + final_value = comparison_value; + /* Reset these in case we normalized the initial value and comparison value above. */ + if (GET_CODE (comparison_value) == CONST_INT + && GET_CODE (initial_value) == CONST_INT) + { + comparison_value = GEN_INT (comparison_val); + final_value + = GEN_INT (comparison_val + INTVAL (bl->initial_value)); + } bl->initial_value = initial_value; - if (GET_CODE (comparison_value) == CONST_INT) - comparison_value = GEN_INT (comparison_val); /* Save some info needed to produce the new insns. */ reg = bl->biv->dest_reg; @@ -7017,7 +7024,6 @@ check_dbra_loop (loop_end, insn_count, loop_start) jump_label = XEXP (SET_SRC (PATTERN (PREV_INSN (loop_end))), 2); new_add_val = GEN_INT (- INTVAL (bl->biv->add_val)); - final_value = comparison_value; /* Set start_value; if this is not a CONST_INT, we need to generate a SUB. Initialize biv to start_value before loop start. -- cgit v1.1