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
This commit is contained in:
Jan Hubicka 2000-04-23 20:25:40 +00:00 committed by Jan Hubicka
parent ff2b942e78
commit 29aef5ca81
2 changed files with 33 additions and 13 deletions

View File

@ -1,3 +1,8 @@
Sun Apr 23 22:23:08 MET DST 2000 Jan Hubicka <jh@suse.cz>
* loop.c (simplify_giv_expr): Be more agressive on simplifying
constant MULT givs.
2000-04-23 Zack Weinberg <zack@wolery.cumb.org>
* cpphash.h (struct definition): Move file, line, col members...

View File

@ -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. */