aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2015-06-30 09:02:00 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2015-06-30 09:02:00 +0000
commita4398a300ed00d842f9786d529a7a4b0fce6e634 (patch)
tree58346bd90053e6a614e0e37ed3fed21fc9b01ece /gcc/testsuite
parent582554e3bc1509b6ddc407004f97e3f756bcedf5 (diff)
downloadgcc-a4398a300ed00d842f9786d529a7a4b0fce6e634.zip
gcc-a4398a300ed00d842f9786d529a7a4b0fce6e634.tar.gz
gcc-a4398a300ed00d842f9786d529a7a4b0fce6e634.tar.bz2
fold-const.c (fold_binary_loc): Move ~X | X folding ...
* fold-const.c (fold_binary_loc): Move ~X | X folding ... * match.pd: ... here. * gcc.dg/fold-ior-2.c: New test. From-SVN: r225164
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.dg/fold-ior-2.c47
2 files changed, 51 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index f249a7d..b006b4c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2015-06-30 Marek Polacek <polacek@redhat.com>
+
+ * gcc.dg/fold-ior-2.c: New test.
+
2015-06-30 Tom de Vries <tom@codesourcery.com>
PR tree-optimization/66652
diff --git a/gcc/testsuite/gcc.dg/fold-ior-2.c b/gcc/testsuite/gcc.dg/fold-ior-2.c
new file mode 100644
index 0000000..6abac9e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/fold-ior-2.c
@@ -0,0 +1,47 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-cddce1" } */
+
+int
+fn1 (int x)
+{
+ return ~x | x;
+}
+
+int
+fn2 (int x)
+{
+ return x | ~x;
+}
+
+unsigned int
+fn3 (unsigned int x)
+{
+ return ~x | x;
+}
+
+unsigned int
+fn4 (unsigned int x)
+{
+ return ~x | x;
+}
+
+int
+fn5 (int x)
+{
+ return ~x | (unsigned) x;
+}
+
+int
+fn6 (int x)
+{
+ return (unsigned) ~x | x;
+}
+
+int
+fn7 (int x)
+{
+ return ~(unsigned) x | x;
+}
+
+/* { dg-final { scan-tree-dump-not "~" "cddce1" } } */
+/* { dg-final { scan-tree-dump-not " \\| " "cddce1" } } */