re PR tree-optimization/21137 (Convert (a >> 2) & 1 != 0 into a & 4 != 0)
authorRoger Sayle <roger@eyesopen.com>
Sun, 26 Feb 2006 15:36:52 +0000 (15:36 +0000)
committerRoger Sayle <sayle@gcc.gnu.org>
Sun, 26 Feb 2006 15:36:52 +0000 (15:36 +0000)
commita861485caf6698fe171b1d80a78f3f73091615eb
tree54fbe907a418470a9df428739064819f26fcfdfd
parentcd683f6da56b08d6cde14e25cd453ea0cc88521f
re PR tree-optimization/21137 (Convert (a >> 2) & 1 != 0 into a & 4 != 0)

2006-02-26  Roger Sayle  <roger@eyesopen.com>
    James A. Morrison  <phython@gcc.gnu.org>

PR middle-end/21137
* fold-const.c (fold_binary) <EQ_EXPR>:  Fold ((X>>C1)&C2) eq/ne 0,
when C2 is a power of two, as either (X&(C2<<C1)) eq/ne 0 if the
new constant C2<<C1, or as (X<0) or (X,false) depending upon the
signedness of the shift operation.

* gcc.dg/fold-eqandshift-1.c: New test case.

Co-Authored-By: James A. Morrison <phython@gcc.gnu.org>
From-SVN: r111453
gcc/ChangeLog
gcc/fold-const.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/fold-eqandshift-1.c [new file with mode: 0644]