aboutsummaryrefslogtreecommitdiff
path: root/gcc/simplify-rtx.c
diff options
context:
space:
mode:
authorLars Brinkhoff <lars@nocrew.org>2001-05-05 00:32:19 +0000
committerGeoffrey Keating <geoffk@gcc.gnu.org>2001-05-05 00:32:19 +0000
commitc52c9a9ceea01062790c7a0fc1a49f10fc5196b4 (patch)
tree054f7a2f2f758e1a6b989434c1f6ff4b2a206faf /gcc/simplify-rtx.c
parent4264cf59cfd4f563445e36c126658541558acab6 (diff)
downloadgcc-c52c9a9ceea01062790c7a0fc1a49f10fc5196b4.zip
gcc-c52c9a9ceea01062790c7a0fc1a49f10fc5196b4.tar.gz
gcc-c52c9a9ceea01062790c7a0fc1a49f10fc5196b4.tar.bz2
simplify-rtx.c (simplify_binary_operation): Simplify ~a + 1 into -a.
2001-05-04 Lars Brinkhoff <lars@nocrew.org> * simplify-rtx.c (simplify_binary_operation): Simplify ~a + 1 into -a. From-SVN: r41854
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r--gcc/simplify-rtx.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 07fb24b..0468820 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -945,6 +945,13 @@ simplify_binary_operation (code, mode, op0, op1)
else if (GET_CODE (op1) == NEG)
return simplify_gen_binary (MINUS, mode, op0, XEXP (op1, 0));
+ /* (~a) + 1 -> -a */
+ if (INTEGRAL_MODE_P (mode)
+ && GET_CODE (op0) == NOT
+ && GET_CODE (op1) == CONST_INT
+ && INTVAL (op1) == 1)
+ return gen_rtx_NEG (mode, XEXP (op0, 0));
+
/* Handle both-operands-constant cases. We can only add
CONST_INTs to constants since the sum of relocatable symbols
can't be handled by most assemblers. Don't add CONST_INT