aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2002-01-25 22:46:07 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2002-01-25 21:46:07 +0000
commit48d79c431ebc7d3b5e41ffc3d331cce06ca6a8c0 (patch)
treee33410df67450dee1a095f29c172688a6e343cd5 /gcc
parent995b5904391de6b8060e74e21654ed2ec5c8cd76 (diff)
downloadgcc-48d79c431ebc7d3b5e41ffc3d331cce06ca6a8c0.zip
gcc-48d79c431ebc7d3b5e41ffc3d331cce06ca6a8c0.tar.gz
gcc-48d79c431ebc7d3b5e41ffc3d331cce06ca6a8c0.tar.bz2
unroll.c (unroll_loop): Lower final_value to nonmemory operand; avoid it's copies.
* unroll.c (unroll_loop): Lower final_value to nonmemory operand; avoid it's copies. From-SVN: r49224
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/unroll.c15
2 files changed, 19 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 713d625..4304801 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+Fri Jan 25 22:42:49 CET 2002 Jan Hubicka <jh@suse.cz>
+
+ * unroll.c (unroll_loop): Lower final_value to nonmemory operand;
+ avoid it's copies.
+
Fri Jan 25 08:26:19 2002 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* builtins.c (expand_builtin_strncpy): Use integer_zerop instead
diff --git a/gcc/unroll.c b/gcc/unroll.c
index ecddc31..9a0cfcf 100644
--- a/gcc/unroll.c
+++ b/gcc/unroll.c
@@ -930,6 +930,19 @@ unroll_loop (loop, insn_count, strength_reduce_p)
start_sequence ();
+ /* Final value may have form of (PLUS val1 const1_rtx). We need
+ to convert it into general operand, so compute the real value. */
+
+ if (GET_CODE (final_value) == PLUS)
+ {
+ final_value = expand_simple_binop (mode, PLUS,
+ copy_rtx (XEXP (final_value, 0)),
+ copy_rtx (XEXP (final_value, 1)),
+ NULL_RTX, 0, OPTAB_LIB_WIDEN);
+ }
+ if (!nonmemory_operand (final_value, VOIDmode))
+ final_value = force_reg (mode, copy_rtx (final_value));
+
/* Calculate the difference between the final and initial values.
Final value may be a (plus (reg x) (const_int 1)) rtx.
Let the following cse pass simplify this if initial value is
@@ -949,7 +962,7 @@ unroll_loop (loop, insn_count, strength_reduce_p)
so we can pretend that the overflow value is 0/~0. */
if (cc == NE || less_p != neg_inc)
- diff = expand_simple_binop (mode, MINUS, copy_rtx (final_value),
+ diff = expand_simple_binop (mode, MINUS, final_value,
copy_rtx (initial_value), NULL_RTX, 0,
OPTAB_LIB_WIDEN);
else