From patchwork Mon Jun 12 15:32:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew MacLeod X-Patchwork-Id: 1793968 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=xnC5oxhx; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QfwgH1Dnkz20QH for ; Tue, 13 Jun 2023 01:32:59 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 264113855898 for ; Mon, 12 Jun 2023 15:32:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 264113855898 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1686583977; bh=vpNWyOiMyW3+E18vfWZNM9bRVbU1ymVupBpkB2FFirg=; h=Date:To:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=xnC5oxhxo/GD66SCH3m8SccOB5+9oJd8J9x7oKbAiaeoOok2u9EqfaY7OYMwibgGz tOCOepJMu4Lf6Q2z3c6U8H4h2WkoV6ZjJwrc0+0MjoZ2qIbSb4u22JA7VBwuPqIt72 foTmLom4FROG8NX0261nW8A4DVCYGvUCpPpzk1Yw= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id B98073857723 for ; Mon, 12 Jun 2023 15:32:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B98073857723 Received: from mail-oi1-f198.google.com (mail-oi1-f198.google.com [209.85.167.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-540-WQx0iabLN9-XIl5OzbkWqA-1; Mon, 12 Jun 2023 11:32:23 -0400 X-MC-Unique: WQx0iabLN9-XIl5OzbkWqA-1 Received: by mail-oi1-f198.google.com with SMTP id 5614622812f47-39c7f777049so3036471b6e.0 for ; Mon, 12 Jun 2023 08:32:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686583939; x=1689175939; h=subject:from:cc:to:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=isiJkMjWZ/DUG8PC332AUCr/BHzk2rOPYNvllcaOq4A=; b=RjUFsfURaKQfsvL7eoED2QbARPzYaDnTJX2qbpEeVpHQ/T+n9FnBiV0G4x+Td426hm N4JGQJeeY3Yyz5mAI14YFlmwlALYCXK58711zc6+fKS0+6WXll4c6EAEL1pK3g+cwo49 5TcWYVjvhOjrM1Apu1EXf7FOXbSuMT2V0/KZml4VNZOwW9/iu7a2qULtbpLU3atqBXTK yxcrCI0KzAga8QSwtxDZ7u/zAkc3EkB5RRUFJcNhZM4sSfUxk5/tP+Dz/B/direRBOIb M30eKRimZYAKaFd0tmt1ibpLvIFen5M9qCWtjO/1+RLb0l6x2I5jnGBfFc4X9cS2Prm1 tw5A== X-Gm-Message-State: AC+VfDwm6SQee4l/uxdhSlDIqZSUdENoVNlzdeUPktAcDz56oisLwwBO qsP8bIilHgvnBK0zGhIN6LLb8qtXbTqaINieqyr+Nq3tu2K665YVmTS5MmI9+dp/jd7y0ZfOwfN aOALnvkaHiLtKDxmUGQRwhquWgWATpx7hjH5+Yj1wsaRE0RHz3qlgoEw5NtWfJ7qR59WS2gvRE4 lKlw== X-Received: by 2002:a05:6808:213:b0:397:fa4e:6107 with SMTP id l19-20020a056808021300b00397fa4e6107mr4386616oie.18.1686583939190; Mon, 12 Jun 2023 08:32:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Fx8gJyk+1OEBtUYCrBOECSBMrrS048AmvpK4zJwPEwRgbHS+RSJcvqa1EojEcM0pkcDEZ4A== X-Received: by 2002:a05:6808:213:b0:397:fa4e:6107 with SMTP id l19-20020a056808021300b00397fa4e6107mr4386600oie.18.1686583938890; Mon, 12 Jun 2023 08:32:18 -0700 (PDT) Received: from ?IPV6:2607:fea8:51df:4200::ca58? ([2607:fea8:51df:4200::ca58]) by smtp.gmail.com with ESMTPSA id o8-20020a05620a130800b0075caf18008bsm2913051qkj.116.2023.06.12.08.32.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 12 Jun 2023 08:32:18 -0700 (PDT) Message-ID: <0b9acc83-57b2-ad2a-efa4-c4744f593348@redhat.com> Date: Mon, 12 Jun 2023 11:32:17 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 To: gcc-patches Cc: "hernandez, aldy" Subject: [COMMITTED 3/17] - Move operator_bitwise_xor to the unified range-op table. X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Andrew MacLeod via Gcc-patches From: Andrew MacLeod Reply-To: Andrew MacLeod Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Bootstraps on x86_64-pc-linux-gnu with no regressions.  Pushed. Andrew From cc18db2826c5449e84366644fa461816fa5f3f99 Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Sat, 10 Jun 2023 16:01:05 -0400 Subject: [PATCH 03/17] Move operator_bitwise_xor to the unified range-op table. * range-op-mixed.h (class operator_bitwise_xor): Move from... * range-op.cc (unified_table::unified_table): Add BIT_XOR_EXPR. (class operator_bitwise_xor): Move from here. (integral_table::integral_table): Remove BIT_XOR_EXPR. (pointer_table::pointer_table): Remove BIT_XOR_EXPR. --- gcc/range-op-mixed.h | 23 +++++++++++++++++++++++ gcc/range-op.cc | 36 +++++++----------------------------- 2 files changed, 30 insertions(+), 29 deletions(-) diff --git a/gcc/range-op-mixed.h b/gcc/range-op-mixed.h index ba04c51a2d8..644473053e0 100644 --- a/gcc/range-op-mixed.h +++ b/gcc/range-op-mixed.h @@ -527,4 +527,27 @@ public: relation_trio rel = TRIO_VARYING) const final override; }; +class operator_bitwise_xor : public range_operator +{ +public: + using range_operator::op1_range; + using range_operator::op2_range; + bool op1_range (irange &r, tree type, + const irange &lhs, const irange &op2, + relation_trio rel = TRIO_VARYING) const final override; + bool op2_range (irange &r, tree type, + const irange &lhs, const irange &op1, + relation_trio rel = TRIO_VARYING) const final override; + bool op1_op2_relation_effect (irange &lhs_range, + tree type, + const irange &op1_range, + const irange &op2_range, + relation_kind rel) const; + void update_bitmask (irange &r, const irange &lh, + const irange &rh) const final override; +private: + void wi_fold (irange &r, tree type, const wide_int &lh_lb, + const wide_int &lh_ub, const wide_int &rh_lb, + const wide_int &rh_ub) const final override; +}; #endif // GCC_RANGE_OP_MIXED_H diff --git a/gcc/range-op.cc b/gcc/range-op.cc index 107582a9571..11f576c55c5 100644 --- a/gcc/range-op.cc +++ b/gcc/range-op.cc @@ -77,6 +77,7 @@ operator_negate op_negate; operator_mult op_mult; operator_addr_expr op_addr; operator_bitwise_not op_bitwise_not; +operator_bitwise_xor op_bitwise_xor; // Invoke the initialization routines for each class of range. @@ -109,6 +110,7 @@ unified_table::unified_table () // integral implementation. set (ADDR_EXPR, op_addr); set (BIT_NOT_EXPR, op_bitwise_not); + set (BIT_XOR_EXPR, op_bitwise_xor); } // The tables are hidden and accessed via a simple extern function. @@ -3732,33 +3734,12 @@ operator_bitwise_or::op2_range (irange &r, tree type, return operator_bitwise_or::op1_range (r, type, lhs, op1); } - -class operator_bitwise_xor : public range_operator +void +operator_bitwise_xor::update_bitmask (irange &r, const irange &lh, + const irange &rh) const { - using range_operator::op1_range; - using range_operator::op2_range; -public: - virtual void wi_fold (irange &r, tree type, - const wide_int &lh_lb, - const wide_int &lh_ub, - const wide_int &rh_lb, - const wide_int &rh_ub) const; - virtual bool op1_range (irange &r, tree type, - const irange &lhs, - const irange &op2, - relation_trio rel = TRIO_VARYING) const; - virtual bool op2_range (irange &r, tree type, - const irange &lhs, - const irange &op1, - relation_trio rel = TRIO_VARYING) const; - virtual bool op1_op2_relation_effect (irange &lhs_range, - tree type, - const irange &op1_range, - const irange &op2_range, - relation_kind rel) const; - void update_bitmask (irange &r, const irange &lh, const irange &rh) const - { update_known_bitmask (r, BIT_XOR_EXPR, lh, rh); } -} op_bitwise_xor; + update_known_bitmask (r, BIT_XOR_EXPR, lh, rh); +} void operator_bitwise_xor::wi_fold (irange &r, tree type, @@ -4588,7 +4569,6 @@ integral_table::integral_table () set (MAX_EXPR, op_max); set (BIT_AND_EXPR, op_bitwise_and); set (BIT_IOR_EXPR, op_bitwise_or); - set (BIT_XOR_EXPR, op_bitwise_xor); } // Initialize any integral operators to the primary table @@ -4618,8 +4598,6 @@ pointer_table::pointer_table () set (BIT_IOR_EXPR, op_pointer_or); set (MIN_EXPR, op_ptr_min_max); set (MAX_EXPR, op_ptr_min_max); - - set (BIT_XOR_EXPR, op_bitwise_xor); } // Initialize any pointer operators to the primary table -- 2.40.1