summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/fold-plusnot-1.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/fold-plusnot-1.c')
-rw-r--r--gcc/testsuite/gcc.dg/fold-plusnot-1.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/fold-plusnot-1.c b/gcc/testsuite/gcc.dg/fold-plusnot-1.c
new file mode 100644
index 000000000..81ddf46d6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/fold-plusnot-1.c
@@ -0,0 +1,30 @@
+/* PR middle-end/30322 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-original" } */
+
+int test1(int a)
+{
+ return a + ~a;
+}
+
+int test2(int b)
+{
+ return ~b + b;
+}
+
+unsigned int test3(unsigned int c)
+{
+ return c + ~c;
+}
+
+unsigned int test4(unsigned int d)
+{
+ return ~d + d;
+}
+
+/* { dg-final { scan-tree-dump-times "\\+ a" 0 "original" } } */
+/* { dg-final { scan-tree-dump-times "\\+ b" 0 "original" } } */
+/* { dg-final { scan-tree-dump-times "\\+ c" 0 "original" } } */
+/* { dg-final { scan-tree-dump-times "\\+ d" 0 "original" } } */
+/* { dg-final { cleanup-tree-dump "original" } } */
+