summaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorYvan Roux <yvan.roux@linaro.org>2016-12-09 12:56:39 +0100
committerYvan Roux <yvan.roux@linaro.org>2016-12-13 11:31:25 +0000
commit87c57e221f001fa26bd1f5f215c8e90e8474974c (patch)
treee293e82e44b4765fac923ecd845def19671c67a9 /gcc/testsuite
parent276e3f572df674a5391a8bba85ed3ab3b04fa2c8 (diff)
downloadlinaro-gcc-87c57e221f001fa26bd1f5f215c8e90e8474974c.tar.gz
linaro-gcc-87c57e221f001fa26bd1f5f215c8e90e8474974c.tar.bz2
linaro-gcc-87c57e221f001fa26bd1f5f215c8e90e8474974c.zip
gcc/
Backport from trunk r241229. 2016-10-17 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org> PR tree-optimization/71636 * match.pd (x & ((1 << b) - 1) -> x & ~(~0 << b)): New pattern. gcc/testsuite/ Backport from trunk r241229. 2016-10-17 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org> * gcc.dg/pr71636-1.c: New test-case. * gcc.dg/pr71636-2.c: Likewise. Change-Id: Ie3ef5051eea791320865f339cb978a2c9e94aa0f
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/gcc.dg/pr71636-1.c9
-rw-r--r--gcc/testsuite/gcc.dg/pr71636-2.c12
2 files changed, 21 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pr71636-1.c b/gcc/testsuite/gcc.dg/pr71636-1.c
new file mode 100644
index 00000000000..2df5f96f467
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr71636-1.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-gimple" } */
+
+unsigned f(unsigned x, unsigned b)
+{
+ return x & ((1U << b) - 1);
+}
+
+/* { dg-final { scan-tree-dump-not "1 <<" "gimple" } } */
diff --git a/gcc/testsuite/gcc.dg/pr71636-2.c b/gcc/testsuite/gcc.dg/pr71636-2.c
new file mode 100644
index 00000000000..9e9297d4a7c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr71636-2.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-forwprop-details" } */
+
+unsigned f(unsigned x, unsigned b)
+{
+ unsigned t1 = 1U << b;
+ unsigned t2 = t1 - 1;
+ unsigned t3 = x & t2;
+ return t3;
+}
+
+/* { dg-final { scan-tree-dump "_\[0-9\] = ~_\[0-9\]" "forwprop1" } } */