aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAndrew Pinski <andrew_pinski@playstation.sony.com>2008-09-18 19:28:48 +0000
committerAndrew Pinski <pinskia@gcc.gnu.org>2008-09-18 12:28:48 -0700
commitb2a38b1d6efb356a088567a520e28261b95501bb (patch)
tree43575ec0b447fc02801ff346a47da451fef0369d /gcc
parentc78a2119d8c5728a09df47c7f30a7a190b6864da (diff)
downloadgcc-b2a38b1d6efb356a088567a520e28261b95501bb.zip
gcc-b2a38b1d6efb356a088567a520e28261b95501bb.tar.gz
gcc-b2a38b1d6efb356a088567a520e28261b95501bb.tar.bz2
re PR rtl-optimization/37451 (Extra addition for doloop in some cases)
2008-09-18 Andrew Pinski <andrew_pinski@playstation.sony.com> PR rtl-opt/37451 * loop-doloop.c (doloop_modify): New argument zero_extend_p and zero extend count after the correction to it is done. (doloop_optimize): Update call to doloop_modify, don't zero extend count before call. From-SVN: r140470
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/loop-doloop.c16
2 files changed, 19 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 26a712f..25f2297 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2008-09-18 Andrew Pinski <andrew_pinski@playstation.sony.com>
+
+ PR rtl-opt/37451
+ * loop-doloop.c (doloop_modify): New argument zero_extend_p and
+ zero extend count after the correction to it is done.
+ (doloop_optimize): Update call to doloop_modify, don't zero extend
+ count before call.
+
2008-09-18 Martin Jambor <mjambor@suse.cz>
* ipa-cp.c (ipcp_estimate_growth): Return 0 instead of false.
diff --git a/gcc/loop-doloop.c b/gcc/loop-doloop.c
index a039f36..25369dd 100644
--- a/gcc/loop-doloop.c
+++ b/gcc/loop-doloop.c
@@ -333,11 +333,13 @@ add_test (rtx cond, edge *e, basic_block dest)
describes the loop, DESC describes the number of iterations of the
loop, and DOLOOP_INSN is the low-overhead looping insn to emit at the
end of the loop. CONDITION is the condition separated from the
- DOLOOP_SEQ. COUNT is the number of iterations of the LOOP. */
+ DOLOOP_SEQ. COUNT is the number of iterations of the LOOP.
+ ZERO_EXTEND_P says to zero extend COUNT after the increment of it to
+ word_mode. */
static void
doloop_modify (struct loop *loop, struct niter_desc *desc,
- rtx doloop_seq, rtx condition, rtx count)
+ rtx doloop_seq, rtx condition, rtx count, bool zero_extend_p)
{
rtx counter_reg;
rtx tmp, noloop = NULL_RTX;
@@ -413,6 +415,10 @@ doloop_modify (struct loop *loop, struct niter_desc *desc,
if (increment_count)
count = simplify_gen_binary (PLUS, mode, count, const1_rtx);
+ if (zero_extend_p)
+ count = simplify_gen_unary (ZERO_EXTEND, word_mode,
+ count, mode);
+
/* Insert initialization of the count register into the loop header. */
start_sequence ();
tmp = force_operand (count, counter_reg);
@@ -547,6 +553,7 @@ doloop_optimize (struct loop *loop)
struct niter_desc *desc;
unsigned word_mode_size;
unsigned HOST_WIDE_INT word_mode_max;
+ bool zero_extend_p = false;
if (dump_file)
fprintf (dump_file, "Doloop: Processing loop %d.\n", loop->num);
@@ -621,8 +628,7 @@ doloop_optimize (struct loop *loop)
{
if (word_mode_size > GET_MODE_BITSIZE (mode))
{
- count = simplify_gen_unary (ZERO_EXTEND, word_mode,
- count, mode);
+ zero_extend_p = true;
iterations = simplify_gen_unary (ZERO_EXTEND, word_mode,
iterations, mode);
iterations_max = simplify_gen_unary (ZERO_EXTEND, word_mode,
@@ -666,7 +672,7 @@ doloop_optimize (struct loop *loop)
return false;
}
- doloop_modify (loop, desc, doloop_seq, condition, count);
+ doloop_modify (loop, desc, doloop_seq, condition, count, zero_extend_p);
return true;
}