summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/fold-xornot-1.c
diff options
context:
space:
mode:
authorsayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2006-10-29 17:51:07 +0000
committersayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2006-10-29 17:51:07 +0000
commit1518c00b2b1db9f64be74ea7261e39cae88638fe (patch)
treeb49a8dec3cf8d233b45cd54501b107cf1aa58844 /gcc/testsuite/gcc.dg/fold-xornot-1.c
parentfe537a55c56e3ff3a238087604a89b1f4fa1f0f5 (diff)
downloadgcc-1518c00b2b1db9f64be74ea7261e39cae88638fe.tar.gz
PR tree-optimization/15458
* fold-const.c (fold_binary): Optimize ~X ^ C as X ^ ~C, where C is a constant. * gcc.dg/fold-xornot-1.c: New test case. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@118152 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/fold-xornot-1.c')
-rw-r--r--gcc/testsuite/gcc.dg/fold-xornot-1.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/fold-xornot-1.c b/gcc/testsuite/gcc.dg/fold-xornot-1.c
new file mode 100644
index 00000000000..c92095d081f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/fold-xornot-1.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-original" } */
+
+int foo(int x)
+{
+ return ~(x ^ 4);
+}
+
+int bar(int y)
+{
+ return ~y ^ 4;
+}
+
+/* { dg-final { scan-tree-dump-times "x \\^ -5" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "y \\^ -5" 1 "original" } } */
+/* { dg-final { cleanup-tree-dump "original" } } */