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
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;
& (((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: