summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/fold-eqand-1.c
diff options
context:
space:
mode:
authorsayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2006-11-12 18:41:31 +0000
committersayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2006-11-12 18:41:31 +0000
commit32484276f69da1dec8600428f6c9eb387aa06a2d (patch)
treeb02ba3cb889c222125601c7fa415210e5d22fcf6 /gcc/testsuite/gcc.dg/fold-eqand-1.c
parent56743459ef01d1123da77ce237b73dfbfd49badd (diff)
downloadgcc-32484276f69da1dec8600428f6c9eb387aa06a2d.tar.gz
PR tree-optimization/13827
* fold-const.c (fold_binary) <EQ_EXPR, NE_EXPR>: Fold (X&C) op (Y&C) as ((X^Y)&C) op 0. * gcc.dg/fold-eqand-1.c: New test case. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@118727 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/fold-eqand-1.c')
-rw-r--r--gcc/testsuite/gcc.dg/fold-eqand-1.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/fold-eqand-1.c b/gcc/testsuite/gcc.dg/fold-eqand-1.c
new file mode 100644
index 00000000000..6ed5b6db0e2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/fold-eqand-1.c
@@ -0,0 +1,17 @@
+/* PR tree-optimization/13827 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-original" } */
+
+unsigned foo (unsigned a, unsigned b)
+{
+ return (a & 0xff00) != (b & 0xff00);
+}
+
+unsigned bar (unsigned c, unsigned d)
+{
+ return (c & 0xff00) == (d & 0xff00);
+}
+
+/* { dg-final { scan-tree-dump-times "a \\^ b" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "c \\^ d" 1 "original" } } */
+/* { dg-final { cleanup-tree-dump "original" } } */