aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1993-07-05 17:56:42 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1993-07-05 17:56:42 -0400
commitbc0776c6205c3f0804cb607214ff51c7eab20a18 (patch)
tree7bd4abba0b13ff7df97f686ded23422e7c788c34 /gcc
parent05a0d5eabb68d036b5717738d601abac96a46c96 (diff)
downloadgcc-bc0776c6205c3f0804cb607214ff51c7eab20a18.zip
gcc-bc0776c6205c3f0804cb607214ff51c7eab20a18.tar.gz
gcc-bc0776c6205c3f0804cb607214ff51c7eab20a18.tar.bz2
(subst, case PLUS): Simplify (plus (comp A B) -1), etc.
From-SVN: r4853
Diffstat (limited to 'gcc')
-rw-r--r--gcc/combine.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index fb63387..b91558a 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -3394,7 +3394,22 @@ subst (x, from, to, in_dest, unique_copy)
goto restart;
}
- /* If only the low-order bit of X is possible nonzero, (plus x -1)
+ /* (plus (comparison A B) C) can become (neg (rev-comp A B)) if
+ C is 1 and STORE_FLAG_VALUE is -1 or if C is -1 and STORE_FLAG_VALUE
+ is 1. This produces better code than the alternative immediately
+ below. */
+ if (GET_RTX_CLASS (GET_CODE (XEXP (x, 0))) == '<'
+ && reversible_comparison_p (XEXP (x, 0))
+ && ((STORE_FLAG_VALUE == -1 && XEXP (x, 1) == const1_rtx)
+ || (STORE_FLAG_VALUE == 1 && XEXP (x, 1) == constm1_rtx)))
+ {
+ x = gen_binary (reverse_condition (GET_CODE (XEXP (x, 0))),
+ mode, XEXP (XEXP (x, 0), 0), XEXP (XEXP (x, 0), 1));
+ x = gen_unary (NEG, mode, x);
+ goto restart;
+ }
+
+ /* If only the low-order bit of X is possibly nonzero, (plus x -1)
can become (ashiftrt (ashift (xor x 1) C) C) where C is
the bitsize of the mode - 1. This allows simplification of
"a = (b & 8) == 0;" */