aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2004-12-18 11:03:49 -0800
committerRichard Henderson <rth@gcc.gnu.org>2004-12-18 11:03:49 -0800
commit2931700801f5ac2d996bc35927674e314629062c (patch)
tree3dc658b9f4a1049ffbec952904cadbb693dd3d0a /gcc/fold-const.c
parentc529c27ef5e80de2e43d2f4028655d4a8baab325 (diff)
downloadgcc-2931700801f5ac2d996bc35927674e314629062c.zip
gcc-2931700801f5ac2d996bc35927674e314629062c.tar.gz
gcc-2931700801f5ac2d996bc35927674e314629062c.tar.bz2
fold-const.c (multiple_of_p): Handle BIT_AND_EXPR when BOTTOM is a power of two.
* fold-const.c (multiple_of_p): Handle BIT_AND_EXPR when BOTTOM is a power of two. From-SVN: r92358
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 2fe0b7e..d249f75 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -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));