===================================================================
@@ -1759,9 +1759,7 @@ integer_all_onesp (const_tree expr)
if (!uns)
return 0;
- /* Note that using TYPE_PRECISION here is wrong. We care about the
- actual bits, not the (arbitrary) range of the type. */
- prec = GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (expr)));
+ prec = TYPE_PRECISION (TREE_TYPE (expr));
if (prec >= HOST_BITS_PER_WIDE_INT)
{
HOST_WIDE_INT high_value;
===================================================================
@@ -8319,6 +8319,12 @@ expand_expr_real_2 (sepops ops, rtx targ
temp = expand_binop (mode, this_optab, op0, op1, target,
unsignedp, OPTAB_LIB_WIDEN);
gcc_assert (temp);
+ /* Bitwise operations do not need bitfield reduction as we expect their
+ operands being properly truncated. */
+ if (code == BIT_XOR_EXPR
+ || code == BIT_AND_EXPR
+ || code == BIT_IOR_EXPR)
+ return temp;
return REDUCE_BIT_FIELD (temp);
}
#undef REDUCE_BIT_FIELD