fold-const.c (fold): Optimize ~X|X and X|~X as -1.
authorRoger Sayle <roger@eyesopen.com>
Sun, 27 Jun 2004 15:23:46 +0000 (15:23 +0000)
committerRoger Sayle <sayle@gcc.gnu.org>
Sun, 27 Jun 2004 15:23:46 +0000 (15:23 +0000)
commit64b663f8bd8abd190e9f2f2aa47dddf60769b8e3
treebf00b8dfd6d9b655b708894fca96a9f725e3610a
parent73bbafe5785c1bcf6ee98c650d91dd78382ee5eb
fold-const.c (fold): Optimize ~X|X and X|~X as -1.

* fold-const.c (fold) <BIT_IOR_EXPR>: Optimize ~X|X and X|~X as -1.
<BIT_XOR_EXPR>: Optimize ~X|X and X|~X as -1.
<BIT_AND_EXPR>: Optimize ~X&X and X&~X as 0.
<TRUTH_AND_EXPR, TRUTH_ANDIF_EXPR>: Optimize !X&&X and X&&!X as false.
        <TRUTH_OR_EXPR, TRUTH_ORIF_EXPR>: Optimize !X||X and !X||X as true.
<TRUTH_XOR_EXPR>: Optimize !X^X and X^X! as true.  Now that
TRUTH_XOR_EXPR is a commutative tree code, don't test whether arg0
is a constant.

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

From-SVN: r83733
gcc/ChangeLog
gcc/fold-const.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/20040627-1.c [new file with mode: 0644]