Commit 139c978a by Jeff Law Committed by Jeff Law

fold-const.c (fold, [...]): Optimize 0 % X.

        * fold-const.c (fold, case CEIL_MOD_EXPR): Optimize 0 % X.
        (case FLOOR_MOD_EXPR, ROUND_MOD_EXPR, TRUNC_MOD_EXPR): Similarly.

From-SVN: r94376
parent 1590d0d4
2005-01-28 Jeff Law <law@redhat.com>
* fold-const.c (fold, case CEIL_MOD_EXPR): Optimize 0 % X.
(case FLOOR_MOD_EXPR, ROUND_MOD_EXPR, TRUNC_MOD_EXPR): Similarly.
2005-01-28 Kazu Hirata <kazu@cs.umass.edu>
* cse.c (cse_reg_info_free_list, cse_reg_info_used_list,
......
......@@ -7875,7 +7875,8 @@ fold (tree expr)
case FLOOR_MOD_EXPR:
case ROUND_MOD_EXPR:
case TRUNC_MOD_EXPR:
if (integer_onep (arg1))
/* 0 % X is always zero as is X % 1. */
if (integer_zerop (arg0) || integer_onep (arg1))
return omit_one_operand (type, integer_zero_node, arg0);
if (integer_zerop (arg1))
return t;
......
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