summaryrefslogtreecommitdiff
path: root/gcc/unroll.c
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2000-09-07 22:26:37 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2000-09-07 22:26:37 +0000
commitff57e249d50d35ee6f637ac963bc70676e1dfc50 (patch)
tree07a0eb7b5b1bf4058491a8b16ec4c39423a361db /gcc/unroll.c
parent1fcd08b185406bf47bb33b56a0ed3d343144f5d9 (diff)
downloadgcc-ff57e249d50d35ee6f637ac963bc70676e1dfc50.tar.gz
* loop.c (strength_reduce): Call check_ext_dependant_givs.
Properly extend the biv initial value for the giv. (record_biv): Zero ext_dependant. (record_giv): New argument ext_val. Update all callers. (general_induction_var): Likewise. (consec_sets_giv): Likewise. (simplify_giv_expr): Likewise. Fill in ext_val if we find a sign-extend, zero-extend, or truncate. (combine_givs_p): Make sure modes are compatible. (check_ext_dependant_givs): New. (extend_value_for_giv): New. * loop.h (struct induction): Add ext_dependant. * unroll.c (iteration_info): Extend the biv initial value for the giv. (find_splittable_givs): Likewise. (final_giv_value): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@36250 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/unroll.c')
-rw-r--r--gcc/unroll.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/gcc/unroll.c b/gcc/unroll.c
index 36e6c57b9f8..51a469dcb48 100644
--- a/gcc/unroll.c
+++ b/gcc/unroll.c
@@ -2495,6 +2495,7 @@ iteration_info (loop, iteration_var, initial_value, increment)
{
HOST_WIDE_INT offset = 0;
struct induction *v = REG_IV_INFO (REGNO (iteration_var));
+ rtx biv_initial_value;
if (REGNO (v->src_reg) >= max_reg_before_loop)
abort ();
@@ -2527,11 +2528,13 @@ iteration_info (loop, iteration_var, initial_value, increment)
fprintf (loop_dump_stream,
"Loop unrolling: Giv iterator, initial value bias %ld.\n",
(long) offset);
+
/* Initial value is mult_val times the biv's initial value plus
add_val. Only useful if it is a constant. */
+ biv_initial_value = extend_value_for_giv (v, bl->initial_value);
*initial_value
= fold_rtx_mult_add (v->mult_val,
- plus_constant (bl->initial_value, offset),
+ plus_constant (biv_initial_value, offset),
v->add_val, v->mode);
}
else
@@ -2895,6 +2898,7 @@ find_splittable_givs (loop, bl, unroll_type, increment, unroll_number)
loop->start);
biv_initial_value = tem;
}
+ biv_initial_value = extend_value_for_giv (v, biv_initial_value);
value = fold_rtx_mult_add (v->mult_val, biv_initial_value,
v->add_val, v->mode);
}
@@ -3456,10 +3460,11 @@ final_giv_value (loop, v)
insert_before = NEXT_INSN (loop_end);
/* Put the final biv value in tem. */
- tem = gen_reg_rtx (bl->biv->mode);
+ tem = gen_reg_rtx (v->mode);
record_base_value (REGNO (tem), bl->biv->add_val, 0);
emit_iv_add_mult (increment, GEN_INT (n_iterations),
- bl->initial_value, tem, insert_before);
+ extend_value_for_giv (v, bl->initial_value),
+ tem, insert_before);
/* Subtract off extra increments as we find them. */
for (insn = NEXT_INSN (v->insn); insn != loop_end;