From patchwork Tue Oct 3 18:34:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 114716 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp2195798qgn; Tue, 3 Oct 2017 11:35:07 -0700 (PDT) X-Received: by 10.99.125.79 with SMTP id m15mr7522299pgn.314.1507055707905; Tue, 03 Oct 2017 11:35:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507055707; cv=none; d=google.com; s=arc-20160816; b=CfUTGWtNva2V1Fv2lnBVgOevFJFgfdogOnZQMRoHH3iln+oLSFpzq0eOMuw82m7kk4 /yNa+sEad1V4BO5GB1LPkv1eClGiVqL+hcy+i6dkEDEUOConZi76ZbE2DCRfcRfSX2sd hha1ut7ISjohfr6w5pH8u4innUZRzuYgdpW+mVKMUePk/I9Q8Ge3cBAlDUOoFNFtft1s sy8DKopfhvfClYIrHIO7DW3UU6HdIhonIyTIhR2PMEhLmX+ZBbqESMtU2LTgf1x+e9qq 3uwdFuGIn5pkkuQTzXQyn34tlOE0rSeJWbKMD6NkRVwXCs50zrIv8x6SSBxDy/f6Jm7t oHPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:message-id:date:subject:mail-followup-to:to :from:delivered-to:sender:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mailing-list:dkim-signature :domainkey-signature:arc-authentication-results; bh=57gkFG1ZiPDagYY7If5iae3Cxe8ktPw5kbOyCPxzsUM=; b=yW2h+ViauFadueaRBaz9553n8U6LAJPV95OJ26NVkYYY2EmJ4I6m2M/QUjV0HedW5o W+dkCpagV2rtSeckswdiX5JKd5XifIjw4vfuMMino3HPuIm6q5iUojljOcIAFueMRVZd SiGNrLgPoQ6zr2WPZUHrL3jiMZOaeynd1gOE3GjsAneaBj2CJeOF/em+PlWjRj1ByqOS ao01bmp1mRjzpgidGsuhshovfLzUTRrwX9syKaZAo1BVvTICM6IYrW2UOw3lwelXI4a4 xjuX5VdJWT/tStpU1hGiL61XC9u2Q64KmzKnGs9iRNbbhgYtRB4K5PcXTMjav+9wuB/n bExg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=WSDo7Rfo; spf=pass (google.com: domain of gcc-patches-return-463401-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-463401-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id n72si10243425pfj.59.2017.10.03.11.35.07 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Oct 2017 11:35:07 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-463401-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=WSDo7Rfo; spf=pass (google.com: domain of gcc-patches-return-463401-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-463401-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; q=dns; s= default; b=lxkhybsW9M89zeQD/7OxWw6BPWYHUl0EDTMVM56hnvBgvm7Tpz1hb u7bhHVEWTZWvL0aiKu2oRYUbdvk2GxyX1+lyD1vrkI0k8TrUDN2sukqcKjTm8U9o e444M0HOO/+RuN+8DJ2P81DBd9P+bRfwjcN+bOCzEfYMXZUnD0Aa7I= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; s= default; bh=QuaRfVOvZMJk8W5PBLs9K922ozw=; b=WSDo7RfoMw65lDnfkDJ/ U9/ME13jqoxnQHUn0lUO4LRIcmKF/WywktN2/fRlrL3OmBFW7NCGPZOldIDKdjOt 1do5GEIhH0YpRDtHIeVISQJ1A6p1E5RvsTplqTHNunrgONyShwzYe7rqpz0OkJeE EhGpbHt2CA5goT3raeukZw4= Received: (qmail 113217 invoked by alias); 3 Oct 2017 18:34:51 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 113205 invoked by uid 89); 3 Oct 2017 18:34:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=inconsistency, treating, sk:richard X-HELO: mail-wr0-f178.google.com Received: from mail-wr0-f178.google.com (HELO mail-wr0-f178.google.com) (209.85.128.178) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 03 Oct 2017 18:34:48 +0000 Received: by mail-wr0-f178.google.com with SMTP id l39so7048214wrl.12 for ; Tue, 03 Oct 2017 11:34:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:mail-followup-to:subject:date:message-id :user-agent:mime-version; bh=57gkFG1ZiPDagYY7If5iae3Cxe8ktPw5kbOyCPxzsUM=; b=bsyvKLcZXmC5HFcSPnnZDayTnsyzu0ZpYYlMsitRY2Q7UR/cGq6js9KTBhkV9+1SmO ZqOLPgZdWfbl0xI5074ZLnJecGyZJy55/pGiGH8yYNmPdMTs0zmNnxNAGY1Zh7jYFB+9 OmGIgttRU01yme4IMVejaPjxWKkM7abM+eJG6fKSPMq1Y2k+6ikoj1Z6Vm9im485a9Mz v7fvXzYuJ7jhASZK1QseotaaP5IrdcpLQpxfHk3MKvuolgJJgeGzMmiq5b95vj7nIa+R u0mCz5ovImFHfkWveL03HjkwmskMPWVVuVeXlSo9xAFBCVTgglHz/wqE+7R70jY2M3Aj luhg== X-Gm-Message-State: AHPjjUjJjogY4htwh24iz6skqcLjRN0mN7fKiogSkSPfzUZj5iDgkWOC +PN0lDf16s9G+jBSL2jC8ZEtqGCfmy8= X-Google-Smtp-Source: AOwi7QAE0dHZPKq/EhxHqeoAFdXpvTWT+85pQXTVEXbzXFS1QgczdQevmXrto3APv6Y2aRVGIZx2WA== X-Received: by 10.223.161.23 with SMTP id o23mr19922999wro.103.1507055685706; Tue, 03 Oct 2017 11:34:45 -0700 (PDT) Received: from localhost ([2.26.27.252]) by smtp.gmail.com with ESMTPSA id m9sm7072913wrf.51.2017.10.03.11.34.43 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 03 Oct 2017 11:34:44 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: Allow non-wi wi Date: Tue, 03 Oct 2017 19:34:39 +0100 Message-ID: <87vajwdqrk.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 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. Tested on aarch64-linux-gnu, x86_64-linux-gnu and powerpc64le-linux-gnu. Also tested by comparing the testsuite assembly output on at least one target per CPU directory. OK to install? Richard 2017-10-03 Richard Sandiford 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. Index: gcc/wide-int.h =================================================================== --- gcc/wide-int.h 2017-09-11 17:10:58.656085547 +0100 +++ gcc/wide-int.h 2017-10-03 19:32:39.077055063 +0100 @@ -262,11 +262,22 @@ #define OFFSET_INT_ELTS (ADDR_MAX_PRECIS #define WI_BINARY_RESULT(T1, T2) \ typename wi::binary_traits ::result_type +/* Likewise for binary operators, which excludes the case in which neither + T1 nor T2 is a wide-int-based type. */ +#define WI_BINARY_OPERATOR_RESULT(T1, T2) \ + typename wi::binary_traits ::operator_result + /* The type of result produced by T1 << T2. Leads to substitution failure if the operation isn't supported. Defined purely for brevity. */ #define WI_SIGNED_SHIFT_RESULT(T1, T2) \ typename wi::binary_traits ::signed_shift_result_type +/* The type of result produced by a sign-agnostic binary predicate on + types T1 and T2. This is bool if wide-int operations make sense for + T1 and T2 and leads to substitution failure otherwise. */ +#define WI_BINARY_PREDICATE_RESULT(T1, T2) \ + typename wi::binary_traits ::predicate_result + /* The type of result produced by a signed binary predicate on types T1 and T2. This is bool if signed comparisons make sense for T1 and T2 and leads to substitution failure otherwise. */ @@ -382,12 +393,15 @@ #define WIDE_INT_REF_FOR(T) \ struct binary_traits { typedef widest_int result_type; + /* Don't define operators for this combination. */ }; template struct binary_traits { typedef wide_int result_type; + typedef result_type operator_result; + typedef bool predicate_result; }; template @@ -397,6 +411,8 @@ #define WIDE_INT_REF_FOR(T) \ so as not to confuse gengtype. */ typedef generic_wide_int < fixed_wide_int_storage ::precision> > result_type; + typedef result_type operator_result; + typedef bool predicate_result; typedef bool signed_predicate_result; }; @@ -404,6 +420,8 @@ #define WIDE_INT_REF_FOR(T) \ struct binary_traits { typedef wide_int result_type; + typedef result_type operator_result; + typedef bool predicate_result; }; template @@ -413,6 +431,8 @@ #define WIDE_INT_REF_FOR(T) \ so as not to confuse gengtype. */ typedef generic_wide_int < fixed_wide_int_storage ::precision> > result_type; + typedef result_type operator_result; + typedef bool predicate_result; typedef result_type signed_shift_result_type; typedef bool signed_predicate_result; }; @@ -420,11 +440,13 @@ #define WIDE_INT_REF_FOR(T) \ template struct binary_traits { + STATIC_ASSERT (int_traits ::precision == int_traits ::precision); /* Spelled out explicitly (rather than through FIXED_WIDE_INT) so as not to confuse gengtype. */ - STATIC_ASSERT (int_traits ::precision == int_traits ::precision); typedef generic_wide_int < fixed_wide_int_storage ::precision> > result_type; + typedef result_type operator_result; + typedef bool predicate_result; typedef result_type signed_shift_result_type; typedef bool signed_predicate_result; }; @@ -433,6 +455,8 @@ #define WIDE_INT_REF_FOR(T) \ struct binary_traits { typedef wide_int result_type; + typedef result_type operator_result; + typedef bool predicate_result; }; } @@ -675,18 +699,6 @@ class GTY(()) generic_wide_int : public template generic_wide_int &operator = (const T &); -#define BINARY_PREDICATE(OP, F) \ - template \ - bool OP (const T &c) const { return wi::F (*this, c); } - -#define UNARY_OPERATOR(OP, F) \ - WI_UNARY_RESULT (generic_wide_int) OP () const { return wi::F (*this); } - -#define BINARY_OPERATOR(OP, F) \ - template \ - WI_BINARY_RESULT (generic_wide_int, T) \ - OP (const T &c) const { return wi::F (*this, c); } - #define ASSIGNMENT_OPERATOR(OP, F) \ template \ generic_wide_int &OP (const T &c) { return (*this = wi::F (*this, c)); } @@ -699,18 +711,6 @@ #define SHIFT_ASSIGNMENT_OPERATOR(OP, OP #define INCDEC_OPERATOR(OP, DELTA) \ generic_wide_int &OP () { *this += DELTA; return *this; } - UNARY_OPERATOR (operator ~, bit_not) - UNARY_OPERATOR (operator -, neg) - BINARY_PREDICATE (operator ==, eq_p) - BINARY_PREDICATE (operator !=, ne_p) - BINARY_OPERATOR (operator &, bit_and) - BINARY_OPERATOR (and_not, bit_and_not) - BINARY_OPERATOR (operator |, bit_or) - BINARY_OPERATOR (or_not, bit_or_not) - BINARY_OPERATOR (operator ^, bit_xor) - BINARY_OPERATOR (operator +, add) - BINARY_OPERATOR (operator -, sub) - BINARY_OPERATOR (operator *, mul) ASSIGNMENT_OPERATOR (operator &=, bit_and) ASSIGNMENT_OPERATOR (operator |=, bit_or) ASSIGNMENT_OPERATOR (operator ^=, bit_xor) @@ -722,9 +722,6 @@ #define INCDEC_OPERATOR(OP, DELTA) \ INCDEC_OPERATOR (operator ++, 1) INCDEC_OPERATOR (operator --, -1) -#undef BINARY_PREDICATE -#undef UNARY_OPERATOR -#undef BINARY_OPERATOR #undef SHIFT_ASSIGNMENT_OPERATOR #undef ASSIGNMENT_OPERATOR #undef INCDEC_OPERATOR @@ -3123,6 +3120,45 @@ SIGNED_BINARY_PREDICATE (operator >=, ge #undef SIGNED_BINARY_PREDICATE +#define UNARY_OPERATOR(OP, F) \ + template \ + WI_UNARY_RESULT (generic_wide_int) \ + OP (const generic_wide_int &x) \ + { \ + return wi::F (x); \ + } + +#define BINARY_PREDICATE(OP, F) \ + template \ + WI_BINARY_PREDICATE_RESULT (T1, T2) \ + OP (const T1 &x, const T2 &y) \ + { \ + return wi::F (x, y); \ + } + +#define BINARY_OPERATOR(OP, F) \ + template \ + WI_BINARY_OPERATOR_RESULT (T1, T2) \ + OP (const T1 &x, const T2 &y) \ + { \ + return wi::F (x, y); \ + } + +UNARY_OPERATOR (operator ~, bit_not) +UNARY_OPERATOR (operator -, neg) +BINARY_PREDICATE (operator ==, eq_p) +BINARY_PREDICATE (operator !=, ne_p) +BINARY_OPERATOR (operator &, bit_and) +BINARY_OPERATOR (operator |, bit_or) +BINARY_OPERATOR (operator ^, bit_xor) +BINARY_OPERATOR (operator +, add) +BINARY_OPERATOR (operator -, sub) +BINARY_OPERATOR (operator *, mul) + +#undef UNARY_OPERATOR +#undef BINARY_PREDICATE +#undef BINARY_OPERATOR + template inline WI_SIGNED_SHIFT_RESULT (T1, T2) operator << (const T1 &x, const T2 &y) Index: gcc/expr.c =================================================================== --- gcc/expr.c 2017-09-25 13:33:39.989814299 +0100 +++ gcc/expr.c 2017-10-03 19:32:39.071055063 +0100 @@ -7153,7 +7153,7 @@ get_inner_reference (tree exp, HOST_WIDE if (wi::neg_p (bit_offset) || !wi::fits_shwi_p (bit_offset)) { offset_int mask = wi::mask (LOG2_BITS_PER_UNIT, false); - offset_int tem = bit_offset.and_not (mask); + offset_int tem = wi::bit_and_not (bit_offset, mask); /* TEM is the bitpos rounded to BITS_PER_UNIT towards -Inf. Subtract it to BIT_OFFSET and add it (scaled) to OFFSET. */ bit_offset -= tem; Index: gcc/fold-const.c =================================================================== --- gcc/fold-const.c 2017-09-25 13:33:39.989814299 +0100 +++ gcc/fold-const.c 2017-10-03 19:32:39.073055063 +0100 @@ -9911,7 +9911,7 @@ fold_binary_loc (location_t loc, TYPE_PRECISION (TREE_TYPE (arg1))); /* If (C1|C2) == ~0 then (X&C1)|C2 becomes X|C2. */ - if (msk.and_not (c1 | c2) == 0) + if (wi::bit_and_not (msk, c1 | c2) == 0) { tem = fold_convert_loc (loc, type, TREE_OPERAND (arg0, 0)); return fold_build2_loc (loc, BIT_IOR_EXPR, type, tem, arg1); @@ -9922,12 +9922,13 @@ fold_binary_loc (location_t loc, mode which allows further optimizations. */ c1 &= msk; c2 &= msk; - wide_int c3 = c1.and_not (c2); + wide_int c3 = wi::bit_and_not (c1, c2); for (w = BITS_PER_UNIT; w <= width; w <<= 1) { wide_int mask = wi::mask (w, false, TYPE_PRECISION (type)); - if (((c1 | c2) & mask) == mask && c1.and_not (mask) == 0) + if (((c1 | c2) & mask) == mask + && wi::bit_and_not (c1, mask) == 0) { c3 = mask; break; Index: gcc/ipa-prop.c =================================================================== --- gcc/ipa-prop.c 2017-06-22 12:22:57.746312683 +0100 +++ gcc/ipa-prop.c 2017-10-03 19:32:39.074055063 +0100 @@ -1931,9 +1931,9 @@ ipa_compute_jump_functions_for_edge (str unsigned align; get_pointer_alignment_1 (arg, &align, &bitpos); - widest_int mask - = wi::mask(TYPE_PRECISION (TREE_TYPE (arg)), false) - .and_not (align / BITS_PER_UNIT - 1); + widest_int mask = wi::bit_and_not + (wi::mask (TYPE_PRECISION (TREE_TYPE (arg)), false), + align / BITS_PER_UNIT - 1); widest_int value = bitpos / BITS_PER_UNIT; ipa_set_jfunc_bits (jfunc, value, mask); } Index: gcc/tree-ssa-ccp.c =================================================================== --- gcc/tree-ssa-ccp.c 2017-09-21 12:00:35.101846471 +0100 +++ gcc/tree-ssa-ccp.c 2017-10-03 19:32:39.075055063 +0100 @@ -569,9 +569,11 @@ get_value_from_alignment (tree expr) gcc_assert (TREE_CODE (expr) == ADDR_EXPR); get_pointer_alignment_1 (expr, &align, &bitpos); - val.mask = (POINTER_TYPE_P (type) || TYPE_UNSIGNED (type) - ? wi::mask (TYPE_PRECISION (type), false) - : -1).and_not (align / BITS_PER_UNIT - 1); + val.mask = wi::bit_and_not + (POINTER_TYPE_P (type) || TYPE_UNSIGNED (type) + ? wi::mask (TYPE_PRECISION (type), false) + : -1, + align / BITS_PER_UNIT - 1); val.lattice_val = wi::sext (val.mask, TYPE_PRECISION (type)) == -1 ? VARYING : CONSTANT; if (val.lattice_val == CONSTANT) @@ -1308,8 +1310,9 @@ bit_value_binop (enum tree_code code, si case BIT_IOR_EXPR: /* The mask is constant where there is a known set bit, (m1 | m2) & ~((v1 & ~m1) | (v2 & ~m2)). */ - *mask = (r1mask | r2mask) - .and_not (r1val.and_not (r1mask) | r2val.and_not (r2mask)); + *mask = wi::bit_and_not (r1mask | r2mask, + wi::bit_and_not (r1val, r1mask) + | wi::bit_and_not (r2val, r2mask)); *val = r1val | r2val; break; @@ -1395,7 +1398,8 @@ bit_value_binop (enum tree_code code, si { /* Do the addition with unknown bits set to zero, to give carry-ins of zero wherever possible. */ - widest_int lo = r1val.and_not (r1mask) + r2val.and_not (r2mask); + widest_int lo = (wi::bit_and_not (r1val, r1mask) + + wi::bit_and_not (r2val, r2mask)); lo = wi::ext (lo, width, sgn); /* Do the addition with unknown bits set to one, to give carry-ins of one wherever possible. */ @@ -1447,7 +1451,7 @@ bit_value_binop (enum tree_code code, si case NE_EXPR: { widest_int m = r1mask | r2mask; - if (r1val.and_not (m) != r2val.and_not (m)) + if (wi::bit_and_not (r1val, m) != wi::bit_and_not (r2val, m)) { *mask = 0; *val = ((code == EQ_EXPR) ? 0 : 1); @@ -1486,8 +1490,10 @@ bit_value_binop (enum tree_code code, si /* If we know the most significant bits we know the values value ranges by means of treating varying bits as zero or one. Do a cross comparison of the max/min pairs. */ - maxmin = wi::cmp (o1val | o1mask, o2val.and_not (o2mask), sgn); - minmax = wi::cmp (o1val.and_not (o1mask), o2val | o2mask, sgn); + maxmin = wi::cmp (o1val | o1mask, + wi::bit_and_not (o2val, o2mask), sgn); + minmax = wi::cmp (wi::bit_and_not (o1val, o1mask), + o2val | o2mask, sgn); if (maxmin < 0) /* o1 is less than o2. */ { *mask = 0; Index: gcc/tree-ssa-math-opts.c =================================================================== --- gcc/tree-ssa-math-opts.c 2017-08-30 12:19:19.718220029 +0100 +++ gcc/tree-ssa-math-opts.c 2017-10-03 19:32:39.075055063 +0100 @@ -2138,7 +2138,7 @@ find_bswap_or_nop_load (gimple *stmt, tr if (wi::neg_p (bit_offset)) { offset_int mask = wi::mask (LOG2_BITS_PER_UNIT, false); - offset_int tem = bit_offset.and_not (mask); + offset_int tem = wi::bit_and_not (bit_offset, mask); /* TEM is the bitpos rounded to BITS_PER_UNIT towards -Inf. Subtract it to BIT_OFFSET and add it (scaled) to OFFSET. */ bit_offset -= tem; Index: gcc/tree-vrp.c =================================================================== --- gcc/tree-vrp.c 2017-09-22 18:00:33.560168917 +0100 +++ gcc/tree-vrp.c 2017-10-03 19:32:39.077055063 +0100 @@ -1769,7 +1769,7 @@ zero_nonzero_bits_from_vr (const tree ex 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_ 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 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_st 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_st } 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;