summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/andor-5.c
diff options
context:
space:
mode:
authorpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>2012-04-24 07:05:09 +0000
committerpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>2012-04-24 07:05:09 +0000
commit10fbe63d951ca7cecaff58553639b3d5aecd996a (patch)
tree4318a722cabc2b845a5409a42ace68e3ffa59666 /gcc/testsuite/gcc.dg/tree-ssa/andor-5.c
parentdae9d0e7becfb34379574c1eb94f9a869da2d371 (diff)
downloadgcc-10fbe63d951ca7cecaff58553639b3d5aecd996a.tar.gz
2012-04-24 Andrew Pinski <apinski@cavium.com>
PR tree-opt/33512 * tree-ssa-forwprop.c (defcodefor_name): New function. (simplify_bitwise_binary): Use defcodefor_name instead of manually Simplify "( X | Y) & X" to X and "( X & Y) | X" to X. Simplify "(~X | Y) & X" to "X & Y" and "(~X & Y) | X" to "X | Y". 2012-04-24 Andrew Pinski <apinski@cavium.com> PR tree-opt/33512 * gcc.dg/tree-ssa/andor-3.c: New testcase. * gcc.dg/tree-ssa/andor-4.c: New testcase. * gcc.dg/tree-ssa/andor-5.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@186749 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/tree-ssa/andor-5.c')
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/andor-5.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/andor-5.c b/gcc/testsuite/gcc.dg/tree-ssa/andor-5.c
new file mode 100644
index 00000000000..15097272a1d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/andor-5.c
@@ -0,0 +1,50 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+int f(int y, int x)
+{
+ int a = x | y;
+ return a & x;
+}
+int f1(int y, int x)
+{
+ int a = y | x;
+ return a & x;
+}
+int f2(int y, int x)
+{
+ int a = x | y;
+ return x & a;
+}
+int f3(int y, int x)
+{
+ int a = x | y;
+ return x & a;
+}
+int f4(int y, int x)
+{
+ int a = x & y;
+ return a | x;
+}
+int f5(int y, int x)
+{
+ int a = y & x;
+ return a | x;
+}
+int f6(int y, int x)
+{
+ int a = x & y;
+ return x | a;
+}
+int f7(int y, int x)
+{
+ int a = x & y;
+ return x | a;
+}
+/* These all should be optimized to just return x; */
+
+
+/* { dg-final { scan-tree-dump-times "\\\|" 0 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "\&" 0 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "return x_..D.;" 8 "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */