From: Toon Moene Date: Sun, 26 Oct 1997 17:05:24 +0000 (+0100) Subject: fold-const (fold): Also simplify FLOOR_DIV_EXPR to EXACT_DIV_EXPR if... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=91585c63e4f946b21ec89f51bb8ec555444ddd1f;p=gcc.git fold-const (fold): Also simplify FLOOR_DIV_EXPR to EXACT_DIV_EXPR if... * fold-const (fold): Also simplify FLOOR_DIV_EXPR to EXACT_DIV_EXPR if the dividend is a multiple of the divisor. From-SVN: r16181 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9ad14ce3434..9b397f9288c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +Sun Oct 26 10:06:11 1997 Toon Moene + + * fold-const (fold): Also simplify FLOOR_DIV_EXPR to EXACT_DIV_EXPR + if the dividend is a multiple of the divisor. + Sun Oct 26 09:21:40 1997 Jeffrey A Law (law@cygnus.com) * toplev.c (flag_rerun_loop_opt): New variable. diff --git a/gcc/fold-const.c b/gcc/fold-const.c index def96bfa627..1e823fbf4c7 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -4610,11 +4610,10 @@ fold (expr) /* If arg0 is a multiple of arg1, then rewrite to the fastest div operation, EXACT_DIV_EXPR. - Note that only CEIL_DIV_EXPR is rewritten now, only because the - others seem to be faster in some cases. This is probably just - due to more work being done to optimize others in expmed.c than on - EXACT_DIV_EXPR. */ - if (code == CEIL_DIV_EXPR + Note that only CEIL_DIV_EXPR and FLOOR_DIV_EXPR are rewritten now. + At one time others generated faster code, it's not clear if they do + after the last round to changes to the DIV code in expmed.c. */ + if ((code == CEIL_DIV_EXPR || code == FLOOR_DIV_EXPR) && multiple_of_p (type, arg0, arg1)) return fold (build (EXACT_DIV_EXPR, type, arg0, arg1));