diff options
author | Charles M. Hannum <root@ihack.net> | 1999-03-25 18:08:54 -0700 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 1999-03-25 18:08:54 -0700 |
commit | 142413745029dfc6147595a843ed06b4b2d2c4ce (patch) | |
tree | d23be2bdb3592e77b8ae3c7ae916c0fb74edd372 /gcc | |
parent | 5197829d3cac9e363ee2c3bdd62999206b5cd2e2 (diff) | |
download | gcc-142413745029dfc6147595a843ed06b4b2d2c4ce.zip gcc-142413745029dfc6147595a843ed06b4b2d2c4ce.tar.gz gcc-142413745029dfc6147595a843ed06b4b2d2c4ce.tar.bz2 |
fold-const.c (fold_truthop): Verify that the lhs and rhs are in the same bit position when...
* fold-const.c (fold_truthop): Verify that the lhs and rhs are
in the same bit position when optimizing bitfield references
which have the same mask.
From-SVN: r25993
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fold-const.c | 4 |
2 files changed, 9 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 92d0f80..148c660 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +Fri Mar 26 01:59:15 1999 "Charles M. Hannum" <root@ihack.net> + + * fold-const.c (fold_truthop): Verify that the lhs and rhs are + in the same bit position when optimizing bitfield references + which have the same mask. + Thu Mar 25 22:53:27 1999 Martin von Löwis <loewis@informatik.hu-berlin.de> * gcc.texi (Copy Assignment): New node. diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 1e7bd19..78d7e41 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -3934,11 +3934,13 @@ fold_truthop (code, truth_type, lhs, rhs) /* Make a mask that corresponds to both fields being compared. Do this for both items being compared. If the masks agree, + and the bits being compared are in the same position, then we can do this by masking both and comparing the masked results. */ ll_mask = const_binop (BIT_IOR_EXPR, ll_mask, rl_mask, 0); lr_mask = const_binop (BIT_IOR_EXPR, lr_mask, rr_mask, 0); - if (operand_equal_p (ll_mask, lr_mask, 0) && lnbitsize == rnbitsize) + if (operand_equal_p (ll_mask, lr_mask, 0) + && lnbitsize == rnbitsize && xll_bitpos == xlr_bitpos) { lhs = make_bit_field_ref (ll_inner, type, lnbitsize, lnbitpos, ll_unsignedp || rl_unsignedp); |