Allow non-wi <op> wi
commit1c8ecf8dd0b0f619243db50a1d3d7a6cf8f1483f
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 9 Oct 2017 10:51:45 +0000 (9 10:51 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 9 Oct 2017 10:51:45 +0000 (9 10:51 +0000)
treef4ff87714e14c46a92572a3688e8ec637e80ea78
parentbd8af2a56bc1d157c4cf5c1c37fd0493dbc55721
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@253539 138bc75d-0d04-0410-961f-82ee72b054a4
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