summaryrefslogtreecommitdiffstats
path: root/gcc/loop.c
diff options
context:
space:
mode:
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>1997-03-16 22:50:56 +0000
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>1997-03-16 22:50:56 +0000
commitb20c4d57d9ac284c6c6ba61b12efe4f9488313ac (patch)
tree35f10784c5bc49520b0e58b68ed1f84ee4481035 /gcc/loop.c
parentd584d9cd40e4961c673a83a94154364015f6feb6 (diff)
downloadppe42-gcc-b20c4d57d9ac284c6c6ba61b12efe4f9488313ac.tar.gz
ppe42-gcc-b20c4d57d9ac284c6c6ba61b12efe4f9488313ac.zip
* loop.c (strength_reduce): Adjust BENEFIT appropriately if an
autoincrement memory reference will eliminate add insns. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@13717 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/loop.c')
-rw-r--r--gcc/loop.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/gcc/loop.c b/gcc/loop.c
index 0ea4f202616..3e7bb58e3e3 100644
--- a/gcc/loop.c
+++ b/gcc/loop.c
@@ -3850,9 +3850,23 @@ strength_reduce (scan_start, end, loop_top, insn_count,
unchanged (recompute it from the biv each time it is used).
This decision can be made independently for each giv. */
- /* ??? Perhaps attempt to guess whether autoincrement will handle
- some of the new add insns; if so, can increase BENEFIT
- (undo the subtraction of add_cost that was done above). */
+#ifdef AUTO_INC_DEC
+ /* Attempt to guess whether autoincrement will handle some of the
+ new add insns; if so, increase BENEFIT (undo the subtraction of
+ add_cost that was done above). */
+ if (v->giv_type == DEST_ADDR
+ && GET_CODE (v->mult_val) == CONST_INT)
+ {
+#if defined (HAVE_POST_INCREMENT) || defined (HAVE_PRE_INCREMENT)
+ if (INTVAL (v->mult_val) == GET_MODE_SIZE (v->mem_mode))
+ benefit += add_cost * bl->biv_count;
+#endif
+#if defined (HAVE_POST_DECREMENT) || defined (HAVE_PRE_DECREMENT)
+ if (-INTVAL (v->mult_val) == GET_MODE_SIZE (v->mem_mode))
+ benefit += add_cost * bl->biv_count;
+#endif
+ }
+#endif
/* If an insn is not to be strength reduced, then set its ignore
flag, and clear all_reduced. */
OpenPOWER on IntegriCloud