Commit 14241374 by Charles M. Hannum Committed by Jeff Law

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
parent 5197829d
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 Lwis <loewis@informatik.hu-berlin.de> Thu Mar 25 22:53:27 1999 Martin von Lwis <loewis@informatik.hu-berlin.de>
* gcc.texi (Copy Assignment): New node. * gcc.texi (Copy Assignment): New node.
......
...@@ -3934,11 +3934,13 @@ fold_truthop (code, truth_type, lhs, rhs) ...@@ -3934,11 +3934,13 @@ fold_truthop (code, truth_type, lhs, rhs)
/* Make a mask that corresponds to both fields being compared. /* Make a mask that corresponds to both fields being compared.
Do this for both items being compared. If the masks agree, 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 we can do this by masking both and comparing the masked
results. */ results. */
ll_mask = const_binop (BIT_IOR_EXPR, ll_mask, rl_mask, 0); ll_mask = const_binop (BIT_IOR_EXPR, ll_mask, rl_mask, 0);
lr_mask = const_binop (BIT_IOR_EXPR, lr_mask, rr_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, lhs = make_bit_field_ref (ll_inner, type, lnbitsize, lnbitpos,
ll_unsignedp || rl_unsignedp); ll_unsignedp || rl_unsignedp);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment