Allow non-wi <op> wi
authorRichard Sandiford <richard.sandiford@linaro.org>
Mon, 9 Oct 2017 10:51:45 +0000 (10:51 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Mon, 9 Oct 2017 10:51:45 +0000 (10:51 +0000)
commit7b27cb4b510c4c0ae8446140929380aba4a9f79a
treef4ff87714e14c46a92572a3688e8ec637e80ea78
parent191411e43abdefb0c999215bf081d4a5776f281a
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
gcc/ChangeLog
gcc/expr.c
gcc/fold-const.c
gcc/ipa-prop.c
gcc/tree-ssa-ccp.c
gcc/tree-ssa-math-opts.c
gcc/tree-vrp.c
gcc/wide-int.h