From: Richard Henderson Date: Wed, 25 Aug 1999 18:14:11 +0000 (-0700) Subject: loop.c (express_from): Try harder to unify (* c N) and (* c M) where N and M are... X-Git-Tag: prereleases/libstdc++-2.92~11035 X-Git-Url: https://gcc.gnu.org/git/?a=commitdiff_plain;h=e0485b850c63ef2686dd3adcd4f8bbabaaa39fb1;p=gcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7267f064574e..30a31f2a5685 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +Wed Aug 25 11:13:29 1999 Richard Henderson + + * 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. + Wed Aug 25 13:55:47 EDT 1999 Andrew MacLeod * sbitmap.h (sbitmap_intersection_of_succs): Add prototype. diff --git a/gcc/loop.c b/gcc/loop.c index 810f3a25c8aa..eb99eca5ccc7 100644 --- a/gcc/loop.c +++ b/gcc/loop.c @@ -6842,6 +6842,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;