expr.c (expand_expr, [...]): Do not call copy_to_reg with VOIDmode operand.
* expr.c (expand_expr, case NE_EXPR): Do not call copy_to_reg with VOIDmode operand. Add compile-time optimization for constant results. From-SVN: r50734
This commit is contained in:
parent
a1652cee9a
commit
c0a3eeacda
2 changed files with 23 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
|||
2002-03-13 Ulrich Weigand <uweigand@de.ibm.com>
|
||||
|
||||
* expr.c (expand_expr, case NE_EXPR): Do not call copy_to_reg with
|
||||
VOIDmode operand. Add compile-time optimization for constant results.
|
||||
|
||||
2002-03-12 Jason Merrill <jason@redhat.com>
|
||||
|
||||
* c-typeck.c (convert_for_assignment): Don't allow conversions
|
||||
|
|
19
gcc/expr.c
19
gcc/expr.c
|
@ -7944,8 +7944,25 @@ expand_expr (exp, target, tmode, modifier)
|
|||
temp = expand_expr (TREE_OPERAND (exp, 0), original_target,
|
||||
VOIDmode, 0);
|
||||
|
||||
/* If temp is constant, we can just compute the result. */
|
||||
if (GET_CODE (temp) == CONST_INT)
|
||||
{
|
||||
if (INTVAL (temp) != 0)
|
||||
emit_move_insn (target, const1_rtx);
|
||||
else
|
||||
emit_move_insn (target, const0_rtx);
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
if (temp != original_target)
|
||||
temp = copy_to_reg (temp);
|
||||
{
|
||||
enum machine_mode mode1 = GET_MODE (temp);
|
||||
if (mode1 == VOIDmode)
|
||||
mode1 = tmode != VOIDmode ? tmode : mode;
|
||||
|
||||
temp = copy_to_mode_reg (mode1, temp);
|
||||
}
|
||||
|
||||
op1 = gen_label_rtx ();
|
||||
emit_cmp_and_jump_insns (temp, const0_rtx, EQ, NULL_RTX,
|
||||
|
|
Loading…
Add table
Reference in a new issue