fold-const.c (fold_truthop): When converting a one-bit comparison don't sign extend the constant.

* fold-const.c (fold_truthop): When converting a one-bit
        comparison don't sign extend the constant.

From-SVN: r26962
This commit is contained in:
Andreas Schwab 1999-05-16 19:24:24 -06:00 committed by Jeff Law
parent 92b3fc3ae3
commit 71a874cd5e
2 changed files with 18 additions and 15 deletions

View File

@ -1,5 +1,13 @@
Mon May 17 01:57:37 1999 David Daney <daney@ibw.com.ni>
* i386/sol2.h (LINK_SPEC): Do not pass "-z text" to the linker
if -mimpure-text.
1999-05-17 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
* fold-const.c (fold_truthop): When converting a one-bit
comparison don't sign extend the constant.
* cse.c (cse_insn): Copy SRC_CONST before putting it in the
REG_EQUAL note.

View File

@ -3806,30 +3806,25 @@ fold_truthop (code, truth_type, lhs, rhs)
{
if (l_const && integer_zerop (l_const) && integer_pow2p (ll_mask))
{
if (ll_unsignedp || tree_log2 (ll_mask) + 1 < ll_bitsize)
l_const = ll_mask;
else
/* Since ll_arg is a single bit bit mask, we can sign extend
it appropriately with a NEGATE_EXPR.
l_const is made a signed value here, but since for l_const != NULL
lr_unsignedp is not used, we don't need to clear the latter. */
l_const = fold (build1 (NEGATE_EXPR, TREE_TYPE (ll_arg),
convert (TREE_TYPE (ll_arg), ll_mask)));
/* Do not sign extend the constant here. The left operand
is either always unsigned or there is a BIT_AND_EXPR that
masks out the extension bits. */
if (! (ll_unsignedp || ll_and_mask != 0))
abort ();
l_const = ll_mask;
}
else
return 0;
}
/* This is analogous to the code for l_const above. */
if (rcode != wanted_code)
{
if (r_const && integer_zerop (r_const) && integer_pow2p (rl_mask))
{
if (rl_unsignedp || tree_log2 (rl_mask) + 1 < rl_bitsize)
r_const = rl_mask;
else
/* This is analogous to the code for l_const above. */
r_const = fold (build1 (NEGATE_EXPR, TREE_TYPE (rl_arg),
convert (TREE_TYPE (rl_arg), rl_mask)));
if (! (rl_unsignedp || rl_and_mask != 0))
abort ();
r_const = rl_mask;
}
else
return 0;