]> gcc.gnu.org Git - gcc.git/commitdiff
tree.def (CEIL_DIV_EXPR, [...]): Tweak comments.
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 21 Oct 2015 21:10:49 +0000 (21:10 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Wed, 21 Oct 2015 21:10:49 +0000 (21:10 +0000)
* tree.def (CEIL_DIV_EXPR, FLOOR_DIV_EXPR, ROUND_DIV_EXPR): Tweak
comments.
(TRUNC_MOD_EXPR, CEIL_MOD_EXPR, FLOOR_MOD_EXPR, ROUND_MOD_EXPR):
Add comments on sign of the result.
* fold-const.c (tree_binary_nonnegative_warnv_p) <FLOOR_MOD_EXPR>:
Recurse on operand #1 instead of operand #0.
<CEIL_MOD_EXPR>: Do not recurse.
<ROUND_MOD_EXPR>: Likewise.

From-SVN: r229146

gcc/ChangeLog
gcc/fold-const.c
gcc/tree.def

index cdeb703dbb7fd75ef0c1d74813bb0fc520be8159..457c3385f8754b34657f212e223d2c590c68f754 100644 (file)
@@ -1,3 +1,14 @@
+2015-10-21  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * tree.def (CEIL_DIV_EXPR, FLOOR_DIV_EXPR, ROUND_DIV_EXPR): Tweak
+       comments.
+       (TRUNC_MOD_EXPR, CEIL_MOD_EXPR, FLOOR_MOD_EXPR, ROUND_MOD_EXPR):
+       Add comments on sign of the result.
+       * fold-const.c (tree_binary_nonnegative_warnv_p) <FLOOR_MOD_EXPR>:
+       Recurse on operand #1 instead of operand #0.
+       <CEIL_MOD_EXPR>: Do not recurse.
+       <ROUND_MOD_EXPR>: Likewise.
+
 2015-10-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
 
        * cfgrtl.c (pass_free_cfg::execute): Adjust.
index 042d43fa70f0065d40e7801a5cfe9cbab9ccca41..b7874a08c0b62acab3762d085de13f223557eb03 100644 (file)
@@ -12908,11 +12908,13 @@ tree_binary_nonnegative_warnv_p (enum tree_code code, tree type, tree op0,
       return RECURSE (op0) && RECURSE (op1);
 
     case TRUNC_MOD_EXPR:
-    case CEIL_MOD_EXPR:
-    case FLOOR_MOD_EXPR:
-    case ROUND_MOD_EXPR:
       return RECURSE (op0);
 
+    case FLOOR_MOD_EXPR:
+      return RECURSE (op1);
+
+    case CEIL_MOD_EXPR:
+    case ROUND_MOD_EXPR:
     default:
       return tree_simple_nonnegative_warnv_p (code, type);
     }
index 64e07270a7ed6de8fd8768ae0bf6b5c3d48feeaa..d0a3bd6839865671a0c8e12958e9cc988aed7354 100644 (file)
@@ -685,19 +685,27 @@ DEFTREECODE (MULT_HIGHPART_EXPR, "mult_highpart_expr", tcc_binary, 2)
 /* Division for integer result that rounds the quotient toward zero.  */
 DEFTREECODE (TRUNC_DIV_EXPR, "trunc_div_expr", tcc_binary, 2)
 
-/* Division for integer result that rounds the quotient toward infinity.  */
+/* Division for integer result that rounds it toward plus infinity.  */
 DEFTREECODE (CEIL_DIV_EXPR, "ceil_div_expr", tcc_binary, 2)
 
-/* Division for integer result that rounds toward minus infinity.  */
+/* Division for integer result that rounds it toward minus infinity.  */
 DEFTREECODE (FLOOR_DIV_EXPR, "floor_div_expr", tcc_binary, 2)
 
-/* Division for integer result that rounds toward nearest integer.  */
+/* Division for integer result that rounds it toward nearest integer.  */
 DEFTREECODE (ROUND_DIV_EXPR, "round_div_expr", tcc_binary, 2)
 
-/* Four kinds of remainder that go with the four kinds of division.  */
+/* Four kinds of remainder that go with the four kinds of division:  */
+
+/* The sign of the remainder is that of the dividend.  */
 DEFTREECODE (TRUNC_MOD_EXPR, "trunc_mod_expr", tcc_binary, 2)
+
+/* The sign of the remainder is the opposite of that of the divisor.  */
 DEFTREECODE (CEIL_MOD_EXPR, "ceil_mod_expr", tcc_binary, 2)
+
+/* The sign of the remainder is that of the divisor.  */
 DEFTREECODE (FLOOR_MOD_EXPR, "floor_mod_expr", tcc_binary, 2)
+
+/* The sign of the remainder is not predictable.  */
 DEFTREECODE (ROUND_MOD_EXPR, "round_mod_expr", tcc_binary, 2)
 
 /* Division for real result.  */
This page took 0.124318 seconds and 5 git commands to generate.