]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
fold-const.c (multiple_of_p): Handle BIT_AND_EXPR when BOTTOM is a power of two.
authorRichard Henderson <rth@redhat.com>
Sat, 18 Dec 2004 19:03:49 +0000 (11:03 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Sat, 18 Dec 2004 19:03:49 +0000 (11:03 -0800)
        * fold-const.c (multiple_of_p): Handle BIT_AND_EXPR when
        BOTTOM is a power of two.

From-SVN: r92358

gcc/ChangeLog
gcc/fold-const.c

index 77b5100c7d9f6f9ee6dd75aecdbfcd789ba7b454..64935f63fb6cc660ba4319652da32ae3334cacdd 100644 (file)
@@ -1,3 +1,8 @@
+2004-12-18  Richard Henderson  <rth@redhat.com>
+
+       * fold-const.c (multiple_of_p): Handle BIT_AND_EXPR when
+       BOTTOM is a power of two.
+
 2004-12-18  Richard Henderson  <rth@redhat.com>
 
        * tree-nested.c (save_tmp_var): New.
index 2fe0b7e7d2b56174c703171a40055a878b808293..d249f75331206554869c8cb0beafa6ff2365616a 100644 (file)
@@ -9541,6 +9541,13 @@ multiple_of_p (tree type, tree top, tree bottom)
 
   switch (TREE_CODE (top))
     {
+    case BIT_AND_EXPR:
+      /* Bitwise and provides a power of two multiple.  If the mask is
+        a multiple of BOTTOM then TOP is a multiple of BOTTOM.  */
+      if (!integer_pow2p (bottom))
+       return 0;
+      /* FALLTHRU */
+
     case MULT_EXPR:
       return (multiple_of_p (type, TREE_OPERAND (top, 0), bottom)
              || multiple_of_p (type, TREE_OPERAND (top, 1), bottom));