Commit ccc5fd95 by Jan Hubicka Committed by Jeff Law

fold-const.c (fold): Convert (or (not arg0) (not arg1)) to (not (and (arg0) (arg1))).

        * fold-const.c (fold): Convert (or (not arg0) (not arg1))
        to (not (and (arg0) (arg1))). Similary for and.

From-SVN: r30001
parent f959ff1a
......@@ -9,6 +9,9 @@ Thu Oct 14 22:14:23 1999 Richard Henderson <rth@cygnus.com>
Thu Oct 14 19:44:08 1999 Jan Hubicka <hubicka@freesoft.cz>
* fold-const.c (fold): Convert (or (not arg0) (not arg1))
to (not (and (arg0) (arg1))). Similary for and.
* fold-const.c (fold): Move bit_rotate code to the EXPR_PLUS case,
falltrought to assocate code.
Convert XOR to OR in code like (a&c1)^(a&c2) where c1 and c2 don't have
......
......@@ -5183,6 +5183,21 @@ fold (expr)
if (t1 != NULL_TREE)
return t1;
/* Convert (or (not arg0) (not arg1)) to (not (and (arg0) (arg1))).
This results in more efficient code for machines without a NAND
instruction. Combine will canonicalize to the first form
which will allow use of NAND instructions provided by the
backend if they exist. */
if (TREE_CODE (arg0) == BIT_NOT_EXPR
&& TREE_CODE (arg1) == BIT_NOT_EXPR)
{
return fold (build1 (BIT_NOT_EXPR, type,
build (BIT_AND_EXPR, type,
TREE_OPERAND (arg0, 0),
TREE_OPERAND (arg1, 0))));
}
/* See if this can be simplified into a rotate first. If that
is unsuccessful continue in the association code. */
goto bit_rotate;
......@@ -5241,6 +5256,22 @@ fold (expr)
& (((HOST_WIDE_INT) 1 << prec) - 1)) == 0)
return build1 (NOP_EXPR, type, TREE_OPERAND (arg0, 0));
}
/* Convert (or (not arg0) (not arg1)) to (not (and (arg0) (arg1))).
This results in more efficient code for machines without a NOR
instruction. Combine will canonicalize to the first form
which will allow use of NOR instructions provided by the
backend if they exist. */
if (TREE_CODE (arg0) == BIT_NOT_EXPR
&& TREE_CODE (arg1) == BIT_NOT_EXPR)
{
return fold (build1 (BIT_NOT_EXPR, type,
build (BIT_IOR_EXPR, type,
TREE_OPERAND (arg0, 0),
TREE_OPERAND (arg1, 0))));
}
goto associate;
case BIT_ANDTC_EXPR:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment