aboutsummaryrefslogtreecommitdiff
path: root/gcc/loop.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@cygnus.com>1999-08-25 11:14:11 -0700
committerRichard Henderson <rth@gcc.gnu.org>1999-08-25 11:14:11 -0700
commite0485b850c63ef2686dd3adcd4f8bbabaaa39fb1 (patch)
tree7a0979de8738df4e7ace539a3fd7680c8d1cf921 /gcc/loop.c
parent37f26d6499f0553e8b9e925c4d724490a24d7ff3 (diff)
downloadgcc-e0485b850c63ef2686dd3adcd4f8bbabaaa39fb1.zip
gcc-e0485b850c63ef2686dd3adcd4f8bbabaaa39fb1.tar.gz
gcc-e0485b850c63ef2686dd3adcd4f8bbabaaa39fb1.tar.bz2
loop.c (express_from): Try harder to unify (* c N) and (* c M) where N and M are constant and N is an...
* loop.c (express_from): Try harder to unify (* c N) and (* c M) where N and M are constant and N is an integer multiple of M. From-SVN: r28868
Diffstat (limited to 'gcc/loop.c')
-rw-r--r--gcc/loop.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/loop.c b/gcc/loop.c
index 810f3a2..eb99eca 100644
--- a/gcc/loop.c
+++ b/gcc/loop.c
@@ -6843,6 +6843,30 @@ express_from (g1, g2)
add = express_from_1 (g1->add_val, g2->add_val, mult);
if (add == NULL_RTX)
+ {
+ /* Failed. If we've got a multiplication factor between G1 and G2,
+ scale G1's addend and try again. */
+ if (INTVAL (mult) > 1)
+ {
+ rtx g1_add_val = g1->add_val;
+ if (GET_CODE (g1_add_val) == MULT
+ && GET_CODE (XEXP (g1_add_val, 1)) == CONST_INT)
+ {
+ HOST_WIDE_INT m;
+ m = INTVAL (mult) * INTVAL (XEXP (g1_add_val, 1));
+ g1_add_val = gen_rtx_MULT (GET_MODE (g1_add_val),
+ XEXP (g1_add_val, 0), GEN_INT (m));
+ }
+ else
+ {
+ g1_add_val = gen_rtx_MULT (GET_MODE (g1_add_val), g1_add_val,
+ mult);
+ }
+
+ add = express_from_1 (g1_add_val, g2->add_val, const1_rtx);
+ }
+ }
+ if (add == NULL_RTX)
return NULL_RTX;
/* Form simplified final result. */