diff options
author | sayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-02-28 21:31:29 +0000 |
---|---|---|
committer | sayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-02-28 21:31:29 +0000 |
commit | 7ae0e4a96c159b4d613f7099ffd6d860ac26a32d (patch) | |
tree | 8d1748fbeb1a55f369adfeaebb8d0d24b433d2d2 /gcc/testsuite/gcc.dg/fold-eqandshift-2.c | |
parent | c5780f6df7be05e8b129d88dadfceaae3a0ec4da (diff) | |
download | gcc-7ae0e4a96c159b4d613f7099ffd6d860ac26a32d.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@111575 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/fold-eqandshift-2.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/fold-eqandshift-2.c | 22 |
1 files changed, 22 insertions, 0 deletions
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" } } */ + |