+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".
if (lcode != wanted_code)
{
if (l_const && integer_zerop (l_const) && integer_pow2p (ll_mask))
- l_const = 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))
- r_const = 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;
}