From 085f17143f3444e9fedce6501e21d28bedac8702 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Mon, 29 May 2000 00:29:13 -0700 Subject: [PATCH] combine.c (combine_simplify_rtx): Don't create an if_then_else unless both args are general_operand. * combine.c (combine_simplify_rtx): Don't create an if_then_else unless both args are general_operand. Don't canonicalize plus to ior unless it helps. From-SVN: r34247 --- gcc/ChangeLog | 4 +++ gcc/combine.c | 75 +++++++++++++++++++++++++++++++-------------------- 2 files changed, 50 insertions(+), 29 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e7f25ce074a..11cfe533520 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2000-05-29 Richard Henderson + * combine.c (combine_simplify_rtx): Don't create an if_then_else + unless both args are general_operand. Don't canonicalize plus + to ior unless it helps. + * toplev.c (rest_of_compilation): Set no_new_pseudos after flow1; instead track register_life_up_to_date. Toggle no_new_pseudos around if_convert. diff --git a/gcc/combine.c b/gcc/combine.c index 8a14d806c68..d4af90e54eb 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -3589,37 +3589,44 @@ combine_simplify_rtx (x, op0_mode, last, in_dest) true = subst (true, pc_rtx, pc_rtx, 0, 0); false = subst (false, pc_rtx, pc_rtx, 0, 0); - /* Restarting if we generate a store-flag expression will cause - us to loop. Just drop through in this case. */ + /* If true and false are not general_operands, an if_then_else + is unlikely to be simpler. */ + if (general_operand (true, VOIDmode) + && general_operand (false, VOIDmode)) + { + /* Restarting if we generate a store-flag expression will cause + us to loop. Just drop through in this case. */ - /* If the result values are STORE_FLAG_VALUE and zero, we can - just make the comparison operation. */ - if (true == const_true_rtx && false == const0_rtx) - x = gen_binary (cond_code, mode, cond, cop1); - else if (true == const0_rtx && false == const_true_rtx) - x = gen_binary (reverse_condition (cond_code), mode, cond, cop1); + /* If the result values are STORE_FLAG_VALUE and zero, we can + just make the comparison operation. */ + if (true == const_true_rtx && false == const0_rtx) + x = gen_binary (cond_code, mode, cond, cop1); + else if (true == const0_rtx && false == const_true_rtx) + x = gen_binary (reverse_condition (cond_code), + mode, cond, cop1); - /* Likewise, we can make the negate of a comparison operation - if the result values are - STORE_FLAG_VALUE and zero. */ - else if (GET_CODE (true) == CONST_INT - && INTVAL (true) == - STORE_FLAG_VALUE - && false == const0_rtx) - x = gen_unary (NEG, mode, mode, - gen_binary (cond_code, mode, cond, cop1)); - else if (GET_CODE (false) == CONST_INT - && INTVAL (false) == - STORE_FLAG_VALUE - && true == const0_rtx) - x = gen_unary (NEG, mode, mode, - gen_binary (reverse_condition (cond_code), - mode, cond, cop1)); - else - return gen_rtx_IF_THEN_ELSE (mode, - gen_binary (cond_code, VOIDmode, - cond, cop1), - true, false); + /* Likewise, we can make the negate of a comparison operation + if the result values are - STORE_FLAG_VALUE and zero. */ + else if (GET_CODE (true) == CONST_INT + && INTVAL (true) == - STORE_FLAG_VALUE + && false == const0_rtx) + x = gen_unary (NEG, mode, mode, + gen_binary (cond_code, mode, cond, cop1)); + else if (GET_CODE (false) == CONST_INT + && INTVAL (false) == - STORE_FLAG_VALUE + && true == const0_rtx) + x = gen_unary (NEG, mode, mode, + gen_binary (reverse_condition (cond_code), + mode, cond, cop1)); + else + return gen_rtx_IF_THEN_ELSE (mode, + gen_binary (cond_code, VOIDmode, + cond, cop1), + true, false); - code = GET_CODE (x); - op0_mode = VOIDmode; + code = GET_CODE (x); + op0_mode = VOIDmode; + } } } @@ -4229,7 +4236,17 @@ combine_simplify_rtx (x, op0_mode, last, in_dest) if (GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT && (nonzero_bits (XEXP (x, 0), mode) & nonzero_bits (XEXP (x, 1), mode)) == 0) - return gen_binary (IOR, mode, XEXP (x, 0), XEXP (x, 1)); + { + /* Try to simplify the expression further. */ + rtx tor = gen_binary (IOR, mode, XEXP (x, 0), XEXP (x, 1)); + temp = combine_simplify_rtx (tor, mode, last, in_dest); + + /* If we could, great. If not, do not go ahead with the IOR + replacement, since PLUS appears in many special purpose + address arithmetic instructions. */ + if (GET_CODE (temp) != CLOBBER && temp != tor) + return temp; + } break; case MINUS: