summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authortege <tege@138bc75d-0d04-0410-961f-82ee72b054a4>1994-11-17 23:31:20 +0000
committertege <tege@138bc75d-0d04-0410-961f-82ee72b054a4>1994-11-17 23:31:20 +0000
commite927ecc8e796471214643f7fa533d772ae571398 (patch)
treef42b01a7bad7022f724bea094fc0e47e0d20fffb /gcc
parent4cbcfb8fc1545db41dba6eca21285f0fc2bf6000 (diff)
downloadgcc-e927ecc8e796471214643f7fa533d772ae571398.tar.gz
(simplify_binary_operation): Do (x - (x & y)) -> (x & ~y).
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@8494 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cse.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/cse.c b/gcc/cse.c
index 103d369f280..487cc3f33c3 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -3718,6 +3718,15 @@ simplify_binary_operation (code, mode, op0, op1)
/* Don't let a relocatable value get a negative coeff. */
if (GET_CODE (op1) == CONST_INT && GET_MODE (op0) != VOIDmode)
return plus_constant (op0, - INTVAL (op1));
+
+ /* (x - (x & y)) -> (x & ~y) */
+ if (GET_CODE (op1) == AND)
+ {
+ if (rtx_equal_p (op0, XEXP (op1, 0)))
+ return cse_gen_binary (AND, mode, op0, gen_rtx (NOT, mode, XEXP (op1, 1)));
+ if (rtx_equal_p (op0, XEXP (op1, 1)))
+ return cse_gen_binary (AND, mode, op0, gen_rtx (NOT, mode, XEXP (op1, 0)));
+ }
break;
case MULT: