fold-const (fold): Also simplify FLOOR_DIV_EXPR to EXACT_DIV_EXPR if...
authorToon Moene <toon@moene.indiv.nluug.nl>
Sun, 26 Oct 1997 17:05:24 +0000 (18:05 +0100)
committerJeff Law <law@gcc.gnu.org>
Sun, 26 Oct 1997 17:05:24 +0000 (10:05 -0700)
        * fold-const (fold): Also simplify FLOOR_DIV_EXPR to EXACT_DIV_EXPR
        if the dividend is a multiple of the divisor.

From-SVN: r16181

gcc/ChangeLog
gcc/fold-const.c

index 9ad14ce343468aa4d5fd97472a3de461484d68cc..9b397f9288c51a8fe2e4d93e37cace6772935ceb 100644 (file)
@@ -1,3 +1,8 @@
+Sun Oct 26 10:06:11 1997  Toon Moene  <toon@moene.indiv.nluug.nl>
+
+       * 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.
index def96bfa627a048a95ad5354d264366f85295123..1e823fbf4c71efbcc9bdd50ffe5c3689c60baa2d 100644 (file)
@@ -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));