aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorRoger Sayle <roger@eyesopen.com>2006-02-28 21:31:29 +0000
committerRoger Sayle <sayle@gcc.gnu.org>2006-02-28 21:31:29 +0000
commitc457fcec8e54df75ee6c133a79cee1417523af59 (patch)
tree8d1748fbeb1a55f369adfeaebb8d0d24b433d2d2 /gcc/testsuite
parent63292ebfb4150f957217ca6243dd6de458242591 (diff)
downloadgcc-c457fcec8e54df75ee6c133a79cee1417523af59.zip
gcc-c457fcec8e54df75ee6c133a79cee1417523af59.tar.gz
gcc-c457fcec8e54df75ee6c133a79cee1417523af59.tar.bz2
re PR tree-optimization/14752 ([tree-ssa] "~a" should be changed to "a" if used in the condition of an if statement)
PR middle-end/14752 * c-common.c (c_common_truthvalue_conversion) <MINUS_EXPR, BIT_XOR_EXPR, BIT_AND_EXPR>: Delete. Let fold optimize these cases via the construction of "expr != 0". * gcc.dg/fold-eqandshift-2.c: New test case. From-SVN: r111575
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/fold-eqandshift-2.c22
2 files changed, 27 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index e0af455..5b2507c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2006-02-28 Roger Sayle <roger@eyesopen.com>
+
+ PR middle-end/14752
+ * gcc.dg/fold-eqandshift-2.c: New test case.
+
2006-02-28 Richard Guenther <rguenther@suse.de>
* gcc.dg/tree-ssa/pr26421.c: Fix testcase to force struct
diff --git a/gcc/testsuite/gcc.dg/fold-eqandshift-2.c b/gcc/testsuite/gcc.dg/fold-eqandshift-2.c
new file mode 100644
index 0000000..14ffb85
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/fold-eqandshift-2.c
@@ -0,0 +1,22 @@
+/* PR middle-end/14752 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-original" } */
+
+void bar (void);
+
+void foo (unsigned int a)
+{
+ if ((a >> 2) & 1)
+ bar ();
+}
+
+void baz (unsigned int b)
+{
+ if ((~b >> 2) & 1)
+ bar ();
+}
+
+/* { dg-final { scan-tree-dump-times "\\(a \& 4\\) != 0" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "\\(b \& 4\\) == 0" 1 "original" } } */
+/* { dg-final { cleanup-tree-dump "original" } } */
+