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:
Ulrich Weigand 2002-03-13 13:00:25 +00:00 committed by Ulrich Weigand
parent a1652cee9a
commit c0a3eeacda
2 changed files with 23 additions and 1 deletions

View file

@ -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

View file

@ -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,