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
This commit is contained in:
Roger Sayle 2006-11-13 23:02:41 +00:00 committed by Roger Sayle
parent 65280f6ca6
commit 7c06f56575
2 changed files with 18 additions and 9 deletions

View File

@ -1,3 +1,8 @@
2006-11-13 Roger Sayle <roger@eyesopen.com>
* fold-const.c (optimize_bit_field_compare): Recursively call
fold when simplifying non-constant comparisons between bit-fields.
2006-11-13 Jakub Jelinek <jakub@redhat.com>
* configure.ac: Add changequote around __LONG_DOUBLE_MATH_OPTIONAL

View File

@ -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