aboutsummaryrefslogtreecommitdiff
path: root/gcc/simplify-rtx.c
diff options
context:
space:
mode:
authorAndrew Pinski <andrew_pinski@playstation.sony.com>2008-02-23 17:58:48 +0000
committerAndrew Pinski <pinskia@gcc.gnu.org>2008-02-23 09:58:48 -0800
commitf79db4f66eba251456c2a9c2fc9d0daef1af9e90 (patch)
treeee2a5464a8fd46288917b5f1ea33c72955e8af86 /gcc/simplify-rtx.c
parentbb1f73c2d57ad7e535fe8dbcc52e2d3a3bc680de (diff)
downloadgcc-f79db4f66eba251456c2a9c2fc9d0daef1af9e90.zip
gcc-f79db4f66eba251456c2a9c2fc9d0daef1af9e90.tar.gz
gcc-f79db4f66eba251456c2a9c2fc9d0daef1af9e90.tar.bz2
re PR tree-optimization/33512 (Simple bitwise simplification missed)
2008-02-23 Andrew Pinski <andrew_pinski@playstation.sony.com> PR rtl-opt/33512 * simplify-rtx.c (simplify_binary_operation_1): Add simplification of (and X (ior (not X) Y) and (and (ior (not X) Y) X). 2008-02-23 Andrew Pinski <andrew_pinski@playstation.sony.com> PR rtl-opt/33512 * gcc.dg/and-1.c: New test. From-SVN: r132575
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r--gcc/simplify-rtx.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index f875604..03fbc75 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -2428,6 +2428,19 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
return simplify_gen_binary (code, mode, tem, op1);
}
}
+
+ /* (and X (ior (not X) Y) -> (and X Y) */
+ if (GET_CODE (op1) == IOR
+ && GET_CODE (XEXP (op1, 0)) == NOT
+ && op0 == XEXP (XEXP (op1, 0), 0))
+ return simplify_gen_binary (AND, mode, op0, XEXP (op1, 1));
+
+ /* (and (ior (not X) Y) X) -> (and X Y) */
+ if (GET_CODE (op0) == IOR
+ && GET_CODE (XEXP (op0, 0)) == NOT
+ && op1 == XEXP (XEXP (op0, 0), 0))
+ return simplify_gen_binary (AND, mode, op1, XEXP (op0, 1));
+
tem = simplify_associative_operation (code, mode, op0, op1);
if (tem)
return tem;