summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr15784-4.c
diff options
context:
space:
mode:
authorphython <phython@138bc75d-0d04-0410-961f-82ee72b054a4>2005-03-04 02:48:30 +0000
committerphython <phython@138bc75d-0d04-0410-961f-82ee72b054a4>2005-03-04 02:48:30 +0000
commitaa8057b43cfc5906f3ec496e182a913613b60a96 (patch)
treec908d67b93dc9a831686bb43afc3806aef6fd260 /gcc/testsuite/gcc.dg/pr15784-4.c
parent35db3ec168fe37033e35bb171191d3f707af8c0d (diff)
downloadgcc-aa8057b43cfc5906f3ec496e182a913613b60a96.tar.gz
2005-03-03 James A. Morrison <phython@gcc.gnu.org>
PR tree-optimization/15784 * fold-const.c (fold): Fold ~A + 1 to -1. Fold -A - 1 and -1 - A to ~A. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@95870 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/pr15784-4.c')
-rw-r--r--gcc/testsuite/gcc.dg/pr15784-4.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pr15784-4.c b/gcc/testsuite/gcc.dg/pr15784-4.c
new file mode 100644
index 00000000000..021b6375efc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr15784-4.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+int a (int x) {
+ return ~x + 1; /* -x */
+}
+
+int b (int x) {
+ return -x -1; /* ~x */
+}
+
+/* { dg-final { scan-tree-dump "~x;" "optimized" } } */
+/* { dg-final { scan-tree-dump "-x;" "optimized" } } */