aboutsummaryrefslogtreecommitdiff
path: root/gcc/combine.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@cygnus.com>2000-05-29 00:29:13 -0700
committerRichard Henderson <rth@gcc.gnu.org>2000-05-29 00:29:13 -0700
commit085f17143f3444e9fedce6501e21d28bedac8702 (patch)
tree99a6776b677f08f40278071b001f9001a3bb9dd1 /gcc/combine.c
parent7b40bc6bda732c991abfc3726bf68a886b876d68 (diff)
downloadgcc-085f17143f3444e9fedce6501e21d28bedac8702.zip
gcc-085f17143f3444e9fedce6501e21d28bedac8702.tar.gz
gcc-085f17143f3444e9fedce6501e21d28bedac8702.tar.bz2
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
Diffstat (limited to 'gcc/combine.c')
-rw-r--r--gcc/combine.c79
1 files changed, 48 insertions, 31 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index 8a14d80..d4af90e 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 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);
+ /* 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);
+
+ /* 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: