aboutsummaryrefslogtreecommitdiff
path: root/gcc/loop.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2000-04-23 20:25:40 +0000
committerJan Hubicka <hubicka@gcc.gnu.org>2000-04-23 20:25:40 +0000
commit29aef5ca814ab84976d233755a0e8d442fe47232 (patch)
treed43104339ec7984ca3c0a48c418e6b90d6f87ddc /gcc/loop.c
parentff2b942e78dc46a8705f54ccd352c51b61163829 (diff)
downloadgcc-29aef5ca814ab84976d233755a0e8d442fe47232.zip
gcc-29aef5ca814ab84976d233755a0e8d442fe47232.tar.gz
gcc-29aef5ca814ab84976d233755a0e8d442fe47232.tar.bz2
loop.c (simplify_giv_expr): Be more agressive on simplifying constant MULT givs.
* loop.c (simplify_giv_expr): Be more agressive on simplifying constant MULT givs. From-SVN: r33357
Diffstat (limited to 'gcc/loop.c')
-rw-r--r--gcc/loop.c41
1 files changed, 28 insertions, 13 deletions
diff --git a/gcc/loop.c b/gcc/loop.c
index e2adbd5..7d7151e 100644
--- a/gcc/loop.c
+++ b/gcc/loop.c
@@ -6402,25 +6402,40 @@ simplify_giv_expr (loop, x, benefit)
return GEN_INT (INTVAL (arg0) * INTVAL (arg1));
case USE:
- /* invar * invar. It is a giv, but very few of these will
- actually pay off, so limit to simple registers. */
+ /* invar * invar is a giv, but attempt to simplify it somehow. */
if (GET_CODE (arg1) != CONST_INT)
return NULL_RTX;
arg0 = XEXP (arg0, 0);
- if (GET_CODE (arg0) == REG)
- tem = gen_rtx_MULT (mode, arg0, arg1);
- else if (GET_CODE (arg0) == MULT
- && GET_CODE (XEXP (arg0, 0)) == REG
- && GET_CODE (XEXP (arg0, 1)) == CONST_INT)
+ if (GET_CODE (arg0) == MULT)
{
- tem = gen_rtx_MULT (mode, XEXP (arg0, 0),
- GEN_INT (INTVAL (XEXP (arg0, 1))
- * INTVAL (arg1)));
+ /* (invar_0 * invar_1) * invar_2. Associate. */
+ return simplify_giv_expr (loop,
+ gen_rtx_MULT (mode,
+ XEXP (arg0, 0),
+ gen_rtx_MULT (mode,
+ XEXP (arg0,
+ 1),
+ arg1)),
+ benefit);
}
- else
- return NULL_RTX;
- return gen_rtx_USE (mode, tem);
+ /* Porpagate the MULT expressions to the intermost nodes. */
+ else if (GET_CODE (arg0) == PLUS)
+ {
+ /* (invar_0 + invar_1) * invar_2. Distribute. */
+ return simplify_giv_expr (loop,
+ gen_rtx_PLUS (mode,
+ gen_rtx_MULT (mode,
+ XEXP (arg0,
+ 0),
+ arg1),
+ gen_rtx_MULT (mode,
+ XEXP (arg0,
+ 1),
+ arg1)),
+ benefit);
+ }
+ return gen_rtx_USE (mode, gen_rtx_MULT (mode, arg0, arg1));
case MULT:
/* (a * invar_1) * invar_2. Associate. */