aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vrp.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@linaro.org>2017-10-09 10:51:45 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2017-10-09 10:51:45 +0000
commit7b27cb4b510c4c0ae8446140929380aba4a9f79a (patch)
treef4ff87714e14c46a92572a3688e8ec637e80ea78 /gcc/tree-vrp.c
parent191411e43abdefb0c999215bf081d4a5776f281a (diff)
downloadgcc-7b27cb4b510c4c0ae8446140929380aba4a9f79a.zip
gcc-7b27cb4b510c4c0ae8446140929380aba4a9f79a.tar.gz
gcc-7b27cb4b510c4c0ae8446140929380aba4a9f79a.tar.bz2
Allow non-wi <op> wi
This patch uses global rather than member operators for wide-int.h, so that the first operand can be a non-wide-int type. The patch also removes the and_not and or_not member functions. It was already inconsistent to have member functions for these two operations (one of which was never used) and not other wi:: ones like udiv. After the operator change, we'd have the additional inconsistency that "non-wi & wi" would work but "non-wi.and_not (wi)" wouldn't. 2017-10-09 Richard Sandiford <richard.sandiford@linaro.org> gcc/ * wide-int.h (WI_BINARY_OPERATOR_RESULT): New macro. (WI_BINARY_PREDICATE_RESULT): Likewise. (wi::binary_traits::operator_result): New type. (wi::binary_traits::predicate_result): Likewise. (generic_wide_int::operator~, unary generic_wide_int::operator-) (generic_wide_int::operator==, generic_wide_int::operator!=) (generic_wide_int::operator&, generic_wide_int::and_not) (generic_wide_int::operator|, generic_wide_int::or_not) (generic_wide_int::operator^, generic_wide_int::operator+ (binary generic_wide_int::operator-, generic_wide_int::operator*): Delete. (operator~, unary operator-, operator==, operator!=, operator&) (operator|, operator^, operator+, binary operator-, operator*): New functions. * expr.c (get_inner_reference): Use wi::bit_and_not. * fold-const.c (fold_binary_loc): Likewise. * ipa-prop.c (ipa_compute_jump_functions_for_edge): Likewise. * tree-ssa-ccp.c (get_value_from_alignment): Likewise. (bit_value_binop): Likewise. * tree-ssa-math-opts.c (find_bswap_or_nop_load): Likewise. * tree-vrp.c (zero_nonzero_bits_from_vr): Likewise. (extract_range_from_binary_expr_1): Likewise. (masked_increment): Likewise. (simplify_bit_ops_using_ranges): Likewise. From-SVN: r253539
Diffstat (limited to 'gcc/tree-vrp.c')
-rw-r--r--gcc/tree-vrp.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 3dba356..3e8be26 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -1769,7 +1769,7 @@ zero_nonzero_bits_from_vr (const tree expr_type,
wide_int mask = wi::mask (wi::floor_log2 (xor_mask), false,
may_be_nonzero->get_precision ());
*may_be_nonzero = *may_be_nonzero | mask;
- *must_be_nonzero = must_be_nonzero->and_not (mask);
+ *must_be_nonzero = wi::bit_and_not (*must_be_nonzero, mask);
}
}
@@ -2975,8 +2975,8 @@ extract_range_from_binary_expr_1 (value_range *vr,
wide_int result_zero_bits = ((must_be_nonzero0 & must_be_nonzero1)
| ~(may_be_nonzero0 | may_be_nonzero1));
wide_int result_one_bits
- = (must_be_nonzero0.and_not (may_be_nonzero1)
- | must_be_nonzero1.and_not (may_be_nonzero0));
+ = (wi::bit_and_not (must_be_nonzero0, may_be_nonzero1)
+ | wi::bit_and_not (must_be_nonzero1, may_be_nonzero0));
max = wide_int_to_tree (expr_type, ~result_zero_bits);
min = wide_int_to_tree (expr_type, result_one_bits);
/* If the range has all positive or all negative values the
@@ -4877,7 +4877,7 @@ masked_increment (const wide_int &val_in, const wide_int &mask,
if ((res & bit) == 0)
continue;
res = bit - 1;
- res = (val + bit).and_not (res);
+ res = wi::bit_and_not (val + bit, res);
res &= mask;
if (wi::gtu_p (res, val))
return res ^ sgnbit;
@@ -9538,13 +9538,13 @@ simplify_bit_ops_using_ranges (gimple_stmt_iterator *gsi, gimple *stmt)
switch (gimple_assign_rhs_code (stmt))
{
case BIT_AND_EXPR:
- mask = may_be_nonzero0.and_not (must_be_nonzero1);
+ mask = wi::bit_and_not (may_be_nonzero0, must_be_nonzero1);
if (mask == 0)
{
op = op0;
break;
}
- mask = may_be_nonzero1.and_not (must_be_nonzero0);
+ mask = wi::bit_and_not (may_be_nonzero1, must_be_nonzero0);
if (mask == 0)
{
op = op1;
@@ -9552,13 +9552,13 @@ simplify_bit_ops_using_ranges (gimple_stmt_iterator *gsi, gimple *stmt)
}
break;
case BIT_IOR_EXPR:
- mask = may_be_nonzero0.and_not (must_be_nonzero1);
+ mask = wi::bit_and_not (may_be_nonzero0, must_be_nonzero1);
if (mask == 0)
{
op = op1;
break;
}
- mask = may_be_nonzero1.and_not (must_be_nonzero0);
+ mask = wi::bit_and_not (may_be_nonzero1, must_be_nonzero0);
if (mask == 0)
{
op = op0;