diff options
author | Richard Henderson <rth@redhat.com> | 2004-12-18 11:03:49 -0800 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2004-12-18 11:03:49 -0800 |
commit | 2931700801f5ac2d996bc35927674e314629062c (patch) | |
tree | 3dc658b9f4a1049ffbec952904cadbb693dd3d0a /gcc | |
parent | c529c27ef5e80de2e43d2f4028655d4a8baab325 (diff) | |
download | gcc-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')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/fold-const.c | 7 |
2 files changed, 12 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 77b5100..64935f6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 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. (struct walk_stmt_info): Add is_lhs. (walk_stmts) <MODIFY_EXPR>: Be more accurate with setting of 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)); |