mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-28 06:34:42 +08:00
* fold-const.c (fold): Fold A - (A & B) into ~B & A.
From-SVN: r64615
This commit is contained in:
parent
101cb92aa6
commit
015c318662
@ -1,3 +1,7 @@
|
||||
2003-03-20 Kazu Hirata <kazu at cs dot umass dot edu>
|
||||
|
||||
* fold-const.c (fold): Fold A - (A & B) into ~B & A.
|
||||
|
||||
2003-03-20 Kazu Hirata <kazu@cs.umass.edu>
|
||||
|
||||
* config/h8300/h8300.md (a peephole2): New.
|
||||
|
@ -5560,6 +5560,22 @@ fold (expr)
|
||||
TREE_OPERAND (arg0, 0),
|
||||
TREE_OPERAND (arg1, 0))),
|
||||
TREE_OPERAND (arg0, 1)));
|
||||
|
||||
/* Fold A - (A & B) into ~B & A. */
|
||||
if (!TREE_SIDE_EFFECTS (arg0)
|
||||
&& TREE_CODE (arg1) == BIT_AND_EXPR)
|
||||
{
|
||||
if (operand_equal_p (arg0, TREE_OPERAND (arg1, 1), 0))
|
||||
return fold (build (BIT_AND_EXPR, type,
|
||||
fold (build1 (BIT_NOT_EXPR, type,
|
||||
TREE_OPERAND (arg1, 0))),
|
||||
arg0));
|
||||
if (operand_equal_p (arg0, TREE_OPERAND (arg1, 0), 0))
|
||||
return fold (build (BIT_AND_EXPR, type,
|
||||
fold (build1 (BIT_NOT_EXPR, type,
|
||||
TREE_OPERAND (arg1, 1))),
|
||||
arg0));
|
||||
}
|
||||
}
|
||||
|
||||
/* See if ARG1 is zero and X - ARG1 reduces to X. */
|
||||
|
Loading…
Reference in New Issue
Block a user