From: Lars Brinkhoff Date: Sat, 5 May 2001 00:32:19 +0000 (+0000) Subject: simplify-rtx.c (simplify_binary_operation): Simplify ~a + 1 into -a. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c52c9a9ceea01062790c7a0fc1a49f10fc5196b4;p=gcc.git simplify-rtx.c (simplify_binary_operation): Simplify ~a + 1 into -a. 2001-05-04 Lars Brinkhoff * simplify-rtx.c (simplify_binary_operation): Simplify ~a + 1 into -a. From-SVN: r41854 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 277e58f2e7b..bc4f951b407 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,12 @@ +2001-05-04 Lars Brinkhoff + + * simplify-rtx.c (simplify_binary_operation): Simplify ~a + 1 + into -a. + 2000-05-04 Franz Sirl - * config/rs6000/rs6000.md (ashldi3 splits): Guard with TARGET_POWERPC64. + * config/rs6000/rs6000.md (ashldi3 splits): Guard with + TARGET_POWERPC64. 2001-05-04 Stephane Carrez diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index 07fb24ba9f0..046882002a5 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