Commit c0a3eeac by Ulrich Weigand Committed by Ulrich Weigand

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
parent a1652cee
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> 2002-03-12 Jason Merrill <jason@redhat.com>
* c-typeck.c (convert_for_assignment): Don't allow conversions * c-typeck.c (convert_for_assignment): Don't allow conversions
......
...@@ -7944,8 +7944,25 @@ expand_expr (exp, target, tmode, modifier) ...@@ -7944,8 +7944,25 @@ expand_expr (exp, target, tmode, modifier)
temp = expand_expr (TREE_OPERAND (exp, 0), original_target, temp = expand_expr (TREE_OPERAND (exp, 0), original_target,
VOIDmode, 0); 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) 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 (); op1 = gen_label_rtx ();
emit_cmp_and_jump_insns (temp, const0_rtx, EQ, NULL_RTX, emit_cmp_and_jump_insns (temp, const0_rtx, EQ, NULL_RTX,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment