Commit ff57e249 authored by rth's avatar rth
Browse files

* 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
parent 1fcd08b1
2000-09-07 Richard Henderson <rth@cygnus.com>
* 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.
2000-09-07 Zack Weinberg <zack@wolery.cumb.org>
* c-pragma.h: Define HANDLE_GENERIC_PRAGMAS if
......@@ -64,9 +82,9 @@ Thu 07-Sep-2000 21:29:00 BST Neil Booth <NeilB@earthling.net>
2000-09-07 Catherine Moore <clm@redhat.com>
* unroll.c (unroll_loop): Check for unconditional jumps
to loop continuation. Delete if n_iterations is 1.
(ujump_to_loop_cont): New routine.
* unroll.c (unroll_loop): Check for unconditional jumps
to loop continuation. Delete if n_iterations is 1.
(ujump_to_loop_cont): New routine.
2000-09-07 Bernd Schmidt <bernds@redhat.co.uk>
......@@ -151,7 +169,7 @@ Thu 07-Sep-2000 21:29:00 BST Neil Booth <NeilB@earthling.net>
2000-09-06 Herman A.J. ten Brugge <Haj.Ten.Brugge@net.HCC.nl>
* flow.c (insn_dead_p): Detect dead memory stores with auto increments.
* flow.c (insn_dead_p): Detect dead memory stores with auto increments.
2000-09-06 Kazu Hirata <kazu@hxi.com>
......@@ -159,7 +177,7 @@ Thu 07-Sep-2000 21:29:00 BST Neil Booth <NeilB@earthling.net>
2000-09-06 Graham Stott <grahams@cygnus.co.uk>
* config/i386/i386.h (ADDRESS_COST): Fix typo.
* config/i386/i386.h (ADDRESS_COST): Fix typo.
2000-09-06 Zack Weinberg <zack@wolery.cumb.org>
......
This diff is collapsed.
......@@ -115,6 +115,8 @@ struct induction
subtracted from add_val when this giv
derives another. This occurs when the
giv spans a biv update by incrementation. */
rtx ext_dependant; /* If nonzero, is a sign or zero extension
if a biv on which this giv is dependant. */
struct induction *next_iv; /* For givs, links together all givs that are
based on the same biv. For bivs, links
together all biv entries that refer to the
......@@ -238,6 +240,7 @@ int loop_invariant_p PARAMS ((const struct loop *, rtx));
rtx get_condition_for_loop PARAMS ((const struct loop *, rtx));
void emit_iv_add_mult PARAMS ((rtx, rtx, rtx, rtx, rtx));
rtx express_from PARAMS ((struct induction *, struct induction *));
rtx extend_value_for_giv PARAMS ((struct induction *, rtx));
void unroll_loop PARAMS ((struct loop *, int, rtx, int));
rtx biv_total_increment PARAMS ((struct iv_class *));
......@@ -251,7 +254,7 @@ void emit_unrolled_add PARAMS ((rtx, rtx, rtx));
int back_branch_in_range_p PARAMS ((const struct loop *, rtx));
int loop_insn_first_p PARAMS ((rtx, rtx));
typedef rtx (*loop_insn_callback ) PARAMS ((struct loop *, rtx, int, int));
typedef rtx (*loop_insn_callback) PARAMS ((struct loop *, rtx, int, int));
void for_each_insn_in_loop PARAMS ((struct loop *, loop_insn_callback));
/* Forward declarations for non-static functions declared in doloop.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;
......
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