* unroll.c (loop_iterations): Handle EQ loops.
From-SVN: r55111
This commit is contained in:
parent
35aba846c1
commit
c8b64bf26d
@ -1,3 +1,7 @@
|
||||
2002-06-30 Alan Modra <amodra@bigpond.net.au>
|
||||
|
||||
* unroll.c (loop_iterations): Handle EQ loops.
|
||||
|
||||
2002-06-29 David Edelsohn <edelsohn@gnu.org>
|
||||
|
||||
* config/rs6000/rs6000.md (ctrdi): Allocate pseudo for FPR
|
||||
|
43
gcc/unroll.c
43
gcc/unroll.c
@ -3941,12 +3941,6 @@ loop_iterations (loop)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else if (comparison_code == EQ)
|
||||
{
|
||||
if (loop_dump_stream)
|
||||
fprintf (loop_dump_stream, "Loop iterations: EQ comparison loop.\n");
|
||||
return 0;
|
||||
}
|
||||
else if (GET_CODE (final_value) != CONST_INT)
|
||||
{
|
||||
if (loop_dump_stream)
|
||||
@ -3958,6 +3952,43 @@ loop_iterations (loop)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else if (comparison_code == EQ)
|
||||
{
|
||||
rtx inc_once;
|
||||
|
||||
if (loop_dump_stream)
|
||||
fprintf (loop_dump_stream, "Loop iterations: EQ comparison loop.\n");
|
||||
|
||||
inc_once = gen_int_mode (INTVAL (initial_value) + INTVAL (increment),
|
||||
GET_MODE (iteration_var));
|
||||
|
||||
if (inc_once == final_value)
|
||||
{
|
||||
/* The iterator value once through the loop is equal to the
|
||||
comparision value. Either we have an infinite loop, or
|
||||
we'll loop twice. */
|
||||
if (increment == const0_rtx)
|
||||
return 0;
|
||||
loop_info->n_iterations = 2;
|
||||
}
|
||||
else
|
||||
loop_info->n_iterations = 1;
|
||||
|
||||
if (GET_CODE (loop_info->initial_value) == CONST_INT)
|
||||
loop_info->final_value
|
||||
= gen_int_mode ((INTVAL (loop_info->initial_value)
|
||||
+ loop_info->n_iterations * INTVAL (increment)),
|
||||
GET_MODE (iteration_var));
|
||||
else
|
||||
loop_info->final_value
|
||||
= plus_constant (loop_info->initial_value,
|
||||
loop_info->n_iterations * INTVAL (increment));
|
||||
loop_info->final_equiv_value
|
||||
= gen_int_mode ((INTVAL (initial_value)
|
||||
+ loop_info->n_iterations * INTVAL (increment)),
|
||||
GET_MODE (iteration_var));
|
||||
return loop_info->n_iterations;
|
||||
}
|
||||
|
||||
/* Final_larger is 1 if final larger, 0 if they are equal, otherwise -1. */
|
||||
if (unsigned_p)
|
||||
|
Loading…
Reference in New Issue
Block a user