summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorsayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2006-11-13 23:02:41 +0000
committersayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2006-11-13 23:02:41 +0000
commitec6721458d7ca8daad35874715c85897f149fc38 (patch)
treee159a838cef09b3940ca6950d9dac78d2cef6b9c /gcc
parentdfce740a3fa3ab39faa588f2db787111510a379f (diff)
downloadgcc-ec6721458d7ca8daad35874715c85897f149fc38.tar.gz
* fold-const.c (optimize_bit_field_compare): Recursively call
fold when simplifying non-constant comparisons between bit-fields. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@118783 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/fold-const.c22
2 files changed, 18 insertions, 9 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 45098d95c0f..965a9cf2281 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index c986503f106..fe7ec587204 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