Commit 8ed69d09 by J"orn Rennecke Committed by Joern Rennecke

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
parent af3d5d53
Fri Aug 28 14:54:07 1998 J"orn Rennecke <amylaar@cygnus.co.uk>
* 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) Thu Aug 27 20:10:46 1998 Jeffrey A Law (law@cygnus.com)
* loop.c (check_dbra_loop): The loop ending comparison value * loop.c (check_dbra_loop): The loop ending comparison value
......
...@@ -7004,11 +7004,18 @@ check_dbra_loop (loop_end, insn_count, loop_start) ...@@ -7004,11 +7004,18 @@ check_dbra_loop (loop_end, insn_count, loop_start)
return 0; return 0;
} }
final_value = comparison_value;
/* Reset these in case we normalized the initial value /* Reset these in case we normalized the initial value
and comparison value above. */ 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; 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. */ /* Save some info needed to produce the new insns. */
reg = bl->biv->dest_reg; reg = bl->biv->dest_reg;
...@@ -7017,7 +7024,6 @@ check_dbra_loop (loop_end, insn_count, loop_start) ...@@ -7017,7 +7024,6 @@ check_dbra_loop (loop_end, insn_count, loop_start)
jump_label = XEXP (SET_SRC (PATTERN (PREV_INSN (loop_end))), 2); jump_label = XEXP (SET_SRC (PATTERN (PREV_INSN (loop_end))), 2);
new_add_val = GEN_INT (- INTVAL (bl->biv->add_val)); 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 /* Set start_value; if this is not a CONST_INT, we need
to generate a SUB. to generate a SUB.
Initialize biv to start_value before loop start. Initialize biv to start_value before loop start.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment