diff options
author | Roger Sayle <roger@eyesopen.com> | 2006-11-13 23:02:41 +0000 |
---|---|---|
committer | Roger Sayle <sayle@gcc.gnu.org> | 2006-11-13 23:02:41 +0000 |
commit | 7c06f565759c2130b55a011ea4cfff278907bda0 (patch) | |
tree | e159a838cef09b3940ca6950d9dac78d2cef6b9c /gcc/fold-const.c | |
parent | 65280f6ca64c7c6f3d13001fcb9007b38ea0046e (diff) | |
download | gcc-7c06f565759c2130b55a011ea4cfff278907bda0.zip gcc-7c06f565759c2130b55a011ea4cfff278907bda0.tar.gz gcc-7c06f565759c2130b55a011ea4cfff278907bda0.tar.bz2 |
fold-const.c (optimize_bit_field_compare): Recursively call fold when simplifying non-constant comparisons between bit-fields.
* fold-const.c (optimize_bit_field_compare): Recursively call
fold when simplifying non-constant comparisons between bit-fields.
From-SVN: r118783
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index c986503..fe7ec58 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -3441,15 +3441,19 @@ optimize_bit_field_compare (enum tree_code code, tree compare_type, if (! const_p) /* If not comparing with constant, just rework the comparison and return. */ - return build2 (code, compare_type, - build2 (BIT_AND_EXPR, unsigned_type, - make_bit_field_ref (linner, unsigned_type, - nbitsize, nbitpos, 1), - mask), - build2 (BIT_AND_EXPR, unsigned_type, - make_bit_field_ref (rinner, unsigned_type, - nbitsize, nbitpos, 1), - mask)); + return fold_build2 (code, compare_type, + fold_build2 (BIT_AND_EXPR, unsigned_type, + make_bit_field_ref (linner, + unsigned_type, + nbitsize, nbitpos, + 1), + mask), + fold_build2 (BIT_AND_EXPR, unsigned_type, + make_bit_field_ref (rinner, + unsigned_type, + nbitsize, nbitpos, + 1), + mask)); /* Otherwise, we are handling the constant case. See if the constant is too big for the field. Warn and return a tree of for 0 (false) if so. We do |