expr.c (expand_expr): Do not apply distributive law in EXPAND_SUM case.
* expr.c (expand_expr) [MULT_EXPR]: Do not apply distributive law in EXPAND_SUM case. Use host_integerp/tree_low_cst. From-SVN: r50033
This commit is contained in:
parent
1bc59af523
commit
3b40e71b7b
2 changed files with 16 additions and 14 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2002-02-25 Richard Henderson <rth@redhat.com>
|
||||||
|
|
||||||
|
* expr.c (expand_expr) [MULT_EXPR]: Do not apply distributive law
|
||||||
|
in EXPAND_SUM case. Use host_integerp/tree_low_cst.
|
||||||
|
|
||||||
2002-02-25 Jakub Jelinek <jakub@redhat.com>
|
2002-02-25 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
PR target/5755
|
PR target/5755
|
||||||
|
|
25
gcc/expr.c
25
gcc/expr.c
|
@ -7610,23 +7610,20 @@ expand_expr (exp, target, tmode, modifier)
|
||||||
indexed address, for machines that support that. */
|
indexed address, for machines that support that. */
|
||||||
|
|
||||||
if (modifier == EXPAND_SUM && mode == ptr_mode
|
if (modifier == EXPAND_SUM && mode == ptr_mode
|
||||||
&& TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST
|
&& host_integerp (TREE_OPERAND (exp, 1), 0))
|
||||||
&& GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT)
|
|
||||||
{
|
{
|
||||||
op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode,
|
op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode,
|
||||||
EXPAND_SUM);
|
EXPAND_SUM);
|
||||||
|
|
||||||
/* Apply distributive law if OP0 is x+c. */
|
/* If we knew for certain that this is arithmetic for an array
|
||||||
if (GET_CODE (op0) == PLUS
|
reference, and we knew the bounds of the array, then we could
|
||||||
&& GET_CODE (XEXP (op0, 1)) == CONST_INT)
|
apply the distributive law across (PLUS X C) for constant C.
|
||||||
return
|
Without such knowledge, we risk overflowing the computation
|
||||||
gen_rtx_PLUS
|
when both X and C are large, but X+C isn't. */
|
||||||
(mode,
|
/* ??? Could perhaps special-case EXP being unsigned and C being
|
||||||
gen_rtx_MULT
|
positive. In that case we are certain that X+C is no smaller
|
||||||
(mode, XEXP (op0, 0),
|
than X and so the transformed expression will overflow iff the
|
||||||
GEN_INT (TREE_INT_CST_LOW (TREE_OPERAND (exp, 1)))),
|
original would have. */
|
||||||
GEN_INT (TREE_INT_CST_LOW (TREE_OPERAND (exp, 1))
|
|
||||||
* INTVAL (XEXP (op0, 1))));
|
|
||||||
|
|
||||||
if (GET_CODE (op0) != REG)
|
if (GET_CODE (op0) != REG)
|
||||||
op0 = force_operand (op0, NULL_RTX);
|
op0 = force_operand (op0, NULL_RTX);
|
||||||
|
@ -7635,7 +7632,7 @@ expand_expr (exp, target, tmode, modifier)
|
||||||
|
|
||||||
return
|
return
|
||||||
gen_rtx_MULT (mode, op0,
|
gen_rtx_MULT (mode, op0,
|
||||||
GEN_INT (TREE_INT_CST_LOW (TREE_OPERAND (exp, 1))));
|
GEN_INT (tree_low_cst (TREE_OPERAND (exp, 1), 0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! safe_from_p (subtarget, TREE_OPERAND (exp, 1), 1))
|
if (! safe_from_p (subtarget, TREE_OPERAND (exp, 1), 1))
|
||||||
|
|
Loading…
Add table
Reference in a new issue