mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-19 22:41:28 +08:00
expr.c (expand_expr <PLUS_EXPR>): Let expand_operands call safe_from_p for us, once it chooses an evaluation order.
* expr.c (expand_expr <PLUS_EXPR>): Let expand_operands call safe_from_p for us, once it chooses an evaluation order. (expand_expr <MULT_EXPR>): Likewise. (expand_expr <MIN_EXPR> <MAX_EXPR>): Likewise. If expand_operands places the second operand in "target", swap the operands. (do_store_flag): Let expand_operands call safe_from_p for us. * gcc.c-torture/execute/20031011-1.c: New testcase. From-SVN: r72376
This commit is contained in:
parent
69efc31da2
commit
e3be111613
@ -1,3 +1,12 @@
|
||||
2003-10-11 Roger Sayle <roger@eyesopen.com>
|
||||
|
||||
* expr.c (expand_expr <PLUS_EXPR>): Let expand_operands call
|
||||
safe_from_p for us, once it chooses an evaluation order.
|
||||
(expand_expr <MULT_EXPR>): Likewise.
|
||||
(expand_expr <MIN_EXPR> <MAX_EXPR>): Likewise. If expand_operands
|
||||
places the second operand in "target", swap the operands.
|
||||
(do_store_flag): Let expand_operands call safe_from_p for us.
|
||||
|
||||
2003-10-11 Eric Botcazou <ebotcazou@libertysurf.fr>
|
||||
|
||||
PR optimization/12544
|
||||
|
18
gcc/expr.c
18
gcc/expr.c
@ -7775,9 +7775,6 @@ expand_expr (tree exp, rtx target, enum machine_mode tmode,
|
||||
}
|
||||
}
|
||||
|
||||
if (! safe_from_p (subtarget, TREE_OPERAND (exp, 1), 1))
|
||||
subtarget = 0;
|
||||
|
||||
/* No sense saving up arithmetic to be done
|
||||
if it's all in the wrong mode to form part of an address.
|
||||
And force_operand won't know whether to sign-extend or
|
||||
@ -7885,9 +7882,6 @@ expand_expr (tree exp, rtx target, enum machine_mode tmode,
|
||||
TYPE_MODE (TREE_TYPE (exp1))));
|
||||
}
|
||||
|
||||
if (! safe_from_p (subtarget, TREE_OPERAND (exp, 1), 1))
|
||||
subtarget = 0;
|
||||
|
||||
if (modifier == EXPAND_STACK_PARM)
|
||||
target = 0;
|
||||
|
||||
@ -8066,7 +8060,6 @@ expand_expr (tree exp, rtx target, enum machine_mode tmode,
|
||||
target = original_target;
|
||||
if (target == 0
|
||||
|| modifier == EXPAND_STACK_PARM
|
||||
|| ! safe_from_p (target, TREE_OPERAND (exp, 1), 1)
|
||||
|| (GET_CODE (target) == MEM && MEM_VOLATILE_P (target))
|
||||
|| GET_MODE (target) != mode
|
||||
|| (GET_CODE (target) == REG
|
||||
@ -8093,6 +8086,14 @@ expand_expr (tree exp, rtx target, enum machine_mode tmode,
|
||||
if (GET_CODE (target) == MEM)
|
||||
target = gen_reg_rtx (mode);
|
||||
|
||||
/* If op1 was placed in target, swap op0 and op1. */
|
||||
if (target != op0 && target == op1)
|
||||
{
|
||||
rtx tem = op0;
|
||||
op0 = op1;
|
||||
op1 = tem;
|
||||
}
|
||||
|
||||
if (target != op0)
|
||||
emit_move_insn (target, op0);
|
||||
|
||||
@ -9589,8 +9590,7 @@ do_store_flag (tree exp, rtx target, enum machine_mode mode, int only_cheap)
|
||||
}
|
||||
|
||||
if (! get_subtarget (target)
|
||||
|| GET_MODE (subtarget) != operand_mode
|
||||
|| ! safe_from_p (subtarget, arg1, 1))
|
||||
|| GET_MODE (subtarget) != operand_mode)
|
||||
subtarget = 0;
|
||||
|
||||
expand_operands (arg0, arg1, subtarget, &op0, &op1, 0);
|
||||
|
@ -1,3 +1,7 @@
|
||||
2003-10-11 Roger Sayle <roger@eyesopen.com>
|
||||
|
||||
* gcc.c-torture/execute/20031011-1.c: New testcase.
|
||||
|
||||
2003-10-11 Eric Botcazou <ebotcazou@libertysurf.fr>
|
||||
|
||||
* gcc.c-torture/compile/20031011-1.c: New test.
|
||||
|
31
gcc/testsuite/gcc.c-torture/execute/20031011-1.c
Normal file
31
gcc/testsuite/gcc.c-torture/execute/20031011-1.c
Normal file
@ -0,0 +1,31 @@
|
||||
/* Check that MAX_EXPR and MIN_EXPR are working properly. */
|
||||
|
||||
#define MAX(X,Y) ((X) > (Y) ? (X) : (Y))
|
||||
#define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
|
||||
|
||||
extern void abort (void);
|
||||
|
||||
int main()
|
||||
{
|
||||
int ll_bitsize, ll_bitpos;
|
||||
int rl_bitsize, rl_bitpos;
|
||||
int end_bit;
|
||||
|
||||
ll_bitpos = 32; ll_bitsize = 32;
|
||||
rl_bitpos = 0; rl_bitsize = 32;
|
||||
|
||||
end_bit = MAX (ll_bitpos + ll_bitsize, rl_bitpos + rl_bitsize);
|
||||
if (end_bit != 64)
|
||||
abort ();
|
||||
end_bit = MAX (rl_bitpos + rl_bitsize, ll_bitpos + ll_bitsize);
|
||||
if (end_bit != 64)
|
||||
abort ();
|
||||
end_bit = MIN (ll_bitpos + ll_bitsize, rl_bitpos + rl_bitsize);
|
||||
if (end_bit != 32)
|
||||
abort ();
|
||||
end_bit = MIN (rl_bitpos + rl_bitsize, ll_bitpos + ll_bitsize);
|
||||
if (end_bit != 32)
|
||||
abort ();
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user