From 7ae0e4a96c159b4d613f7099ffd6d860ac26a32d Mon Sep 17 00:00:00 2001 From: sayle Date: Tue, 28 Feb 2006 21:31:29 +0000 Subject: PR middle-end/14752 * c-common.c (c_common_truthvalue_conversion) : Delete. Let fold optimize these cases via the construction of "expr != 0". * gcc.dg/fold-eqandshift-2.c: New test case. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@111575 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/gcc.dg/fold-eqandshift-2.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/fold-eqandshift-2.c (limited to 'gcc/testsuite/gcc.dg/fold-eqandshift-2.c') 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 00000000000..14ffb852dd4 --- /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" } } */ + -- cgit v1.2.1