Commit 5a6b3365 by J"orn Rennecke Committed by Joern Rennecke

fold-const.c (fold_truthop): When changing a one-bit comparison against zero…

fold-const.c (fold_truthop): When changing a one-bit comparison against zero into a comparison against mask...

	* fold-const.c (fold_truthop): When changing a one-bit comparison
	against zero into a comparison against mask, do a proper sign
	extension.

From-SVN: r16448
parent 2bd3bc6f
Thu Nov 13 00:06:58 1997 J"orn Rennecke <amylaar@cygnus.co.uk>
* fold-const.c (fold_truthop): When changing a one-bit comparison
against zero into a comparison against mask, do a proper sign
extension.
Wed Nov 12 09:37:01 1997 Jeffrey A Law (law@cygnus.com)
* except.c: Do not include "assert.h".
......
......@@ -3424,16 +3424,33 @@ fold_truthop (code, truth_type, lhs, rhs)
if (lcode != wanted_code)
{
if (l_const && integer_zerop (l_const) && integer_pow2p (ll_mask))
{
if (ll_unsignedp)
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)));
}
else
return 0;
}
if (rcode != wanted_code)
{
if (r_const && integer_zerop (r_const) && integer_pow2p (rl_mask))
{
if (rl_unsignedp)
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)));
}
else
return 0;
}
......
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