aboutsummaryrefslogtreecommitdiff
path: root/gcc/combine.c
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1992-12-27 06:52:16 -0500
committerRichard Kenner <kenner@gcc.gnu.org>1992-12-27 06:52:16 -0500
commit818b11b942756b6af4e2dd01e2893e224076d40c (patch)
tree427a97eebe48afa2f8c4e8369bce19e50ff1b38a /gcc/combine.c
parent3b94d087e81d9b39a0944a325825d49b557f3423 (diff)
downloadgcc-818b11b942756b6af4e2dd01e2893e224076d40c.zip
gcc-818b11b942756b6af4e2dd01e2893e224076d40c.tar.gz
gcc-818b11b942756b6af4e2dd01e2893e224076d40c.tar.bz2
(subst, comparison cases): Expand any compound operation that is an operand...
(subst, comparison cases): Expand any compound operation that is an operand; rerun subst on simplified result in one new case. From-SVN: r2922
Diffstat (limited to 'gcc/combine.c')
-rw-r--r--gcc/combine.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index 360c81e..db80ef2 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -3370,17 +3370,27 @@ subst (x, from, to, in_dest, unique_copy)
/* If STORE_FLAG_VALUE is 1, we can convert (ne x 0) to simply X
if only the low-order bit is significant in X (such as when
X is a ZERO_EXTRACT of one bit. Similarly, we can convert
- EQ to (xor X 1). */
+ EQ to (xor X 1). Remove any ZERO_EXTRACT we made when thinking
+ this was a comparison. It may now be simpler to use, e.g., an
+ AND. If a ZERO_EXTRACT is indeed appropriate, it will
+ be placed back by the call to make_compound_operation in the
+ SET case. */
if (new_code == NE && GET_MODE_CLASS (mode) == MODE_INT
&& op1 == const0_rtx
&& significant_bits (op0, GET_MODE (op0)) == 1)
- return gen_lowpart_for_combine (mode, op0);
+ return gen_lowpart_for_combine (mode,
+ expand_compound_operation (op0));
else if (new_code == EQ && GET_MODE_CLASS (mode) == MODE_INT
&& op1 == const0_rtx
&& significant_bits (op0, GET_MODE (op0)) == 1)
- return gen_rtx_combine (XOR, mode,
- gen_lowpart_for_combine (mode, op0),
- const1_rtx);
+ {
+ op0 = expand_compound_operation (op0);
+
+ x = gen_rtx_combine (XOR, mode,
+ gen_lowpart_for_combine (mode, op0),
+ const1_rtx);
+ goto restart;
+ }
#endif
#if STORE_FLAG_VALUE == -1
@@ -3392,6 +3402,7 @@ subst (x, from, to, in_dest, unique_copy)
&& op1 == const0_rtx
&& significant_bits (op0, GET_MODE (op0)) == 1)
{
+ op0 = expand_compound_operation (op0);
x = gen_rtx_combine (NEG, mode,
gen_lowpart_for_combine (mode, op0));
goto restart;
@@ -3411,7 +3422,8 @@ subst (x, from, to, in_dest, unique_copy)
&& mode == GET_MODE (op0)
&& (i = exact_log2 (significant_bits (op0, GET_MODE (op0)))) >= 0)
{
- x = simplify_shift_const (NULL_RTX, ASHIFT, mode, op0,
+ x = simplify_shift_const (NULL_RTX, ASHIFT, mode,
+ expand_compound_operation (op0),
GET_MODE_BITSIZE (mode) - 1 - i);
if (GET_CODE (x) == AND && XEXP (x, 1) == const_true_rtx)
return XEXP (x, 0);