From patchwork Mon Jun 12 15:32:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew MacLeod X-Patchwork-Id: 1793972 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=8.43.85.97; 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=SFzb9eKl; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (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 4Qfwhj2g5nz20QH for ; Tue, 13 Jun 2023 01:34:13 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4FC0F38319FF for ; Mon, 12 Jun 2023 15:34:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4FC0F38319FF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1686584051; bh=zJBrDKGmYkii7BC1HyA/nYY7oMknsfKAuOQTVherBPA=; h=Date:To:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=SFzb9eKl4OcGMQe0j3UqB/oSvGrER74IYyxsz9HF4C3sK10Fg2j3wCo5qrY+Yl/Rp KaQMY5ndO9CadaxJa/mFf0fJeUSixfzZg8KcljyLvtR00XQPZM7CDqUwwD7RWoPZgA 2buvX+wDg+jlNvRXGtP6Rxdd46uKcOD8928FOrEQ= 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 C01E7385771E for ; Mon, 12 Jun 2023 15:32:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C01E7385771E Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-442-2_UNyWOPNviFtd9ZLBlceQ-1; Mon, 12 Jun 2023 11:32:34 -0400 X-MC-Unique: 2_UNyWOPNviFtd9ZLBlceQ-1 Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-62dec818268so165066d6.0 for ; Mon, 12 Jun 2023 08:32:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686583949; x=1689175949; 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=WZoCXT1yDrKdKBDEIpk9z2vgJ/hQoDz6i8KWY2wEfHE=; b=XMlinZKyFv0EFwv5K8cgqbOjen7hce9lDH/Fi06INbVwEoXmWPF0BQCFW181WBQEZ2 C0bRpiszgWnGMlM7U7UE8QD/wJ2tkRRop3Wl7Ja1FLw6RJgZl7aibpIusYoV4FvoX2+d 4vDINrlVfVDhdTrScyYN2Q82plMtU9jLoQHdFasj4FyW5EcIxDBdE5pse80c6HVXhv0E cRspM+WJEWl4JOFaC6wvSirtyDXKJ9Pcw5qmDUkEUABlkTaG8bPeXvRwfhnolWCX8NQ3 n0f6pF/d4wDqcKoUWpmwqqTVamnGHWRkz/HXpycKpUBS7evwhsTzYyG0RnRXgFpw3Fi2 6f3A== X-Gm-Message-State: AC+VfDz6KixQTadrHKUF3gJ/Q0+w6HVSIG+pNCcHwaFDvFEOodqR1MD7 GzhOkStrtsDrJeKI/BGDNm/9C4GdYTmUd1UKtuOMdCJ1NXAIAPXKejJwbI1BmgdmOyqLO/ONN7/ RwKUR8YbvDb1aDDCdhJ4I8klvcZ9yvWcx6/1zWqVY8HmVP96kGxEclMvN6FPRNr0Hz25zpbdOE8 hk9A== X-Received: by 2002:a05:6214:21ec:b0:62b:5aef:ee66 with SMTP id p12-20020a05621421ec00b0062b5aefee66mr9818989qvj.19.1686583948950; Mon, 12 Jun 2023 08:32:28 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ569y0Lahu1a5BlfxCL+qEwrh0qpBJPlg5rKQSlsnWPUOVQr3ddViZPfyCGJCBIXuC7yQjQdw== X-Received: by 2002:a05:6214:21ec:b0:62b:5aef:ee66 with SMTP id p12-20020a05621421ec00b0062b5aefee66mr9818961qvj.19.1686583948513; Mon, 12 Jun 2023 08:32:28 -0700 (PDT) Received: from ?IPV6:2607:fea8:51df:4200::ca58? ([2607:fea8:51df:4200::ca58]) by smtp.gmail.com with ESMTPSA id u5-20020a0c8dc5000000b006261d4ae7a5sm3261140qvb.68.2023.06.12.08.32.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 12 Jun 2023 08:32:28 -0700 (PDT) Message-ID: <158c083d-028a-56b4-8fa8-5c2df0e9af5f@redhat.com> Date: Mon, 12 Jun 2023 11:32:27 -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 5/17] - Move operator_bitwise_or 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 a71ee5c2d48691280f76a90e2838d968f45de0c8 Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Sat, 10 Jun 2023 16:05:33 -0400 Subject: [PATCH 05/17] Move operator_bitwise_or to the unified range-op table. * range-op-mixed.h (class operator_bitwise_or): Move from... * range-op.cc (unified_table::unified_table): Add BIT_IOR_EXPR. (class operator_bitwise_or): Move from here. (integral_table::integral_table): Remove BIT_IOR_EXPR. --- gcc/range-op-mixed.h | 19 +++++++++++++++++++ gcc/range-op.cc | 28 +++++++--------------------- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/gcc/range-op-mixed.h b/gcc/range-op-mixed.h index b3d51f8a54e..8a11d61220c 100644 --- a/gcc/range-op-mixed.h +++ b/gcc/range-op-mixed.h @@ -577,4 +577,23 @@ private: const irange &op2) const; }; +class operator_bitwise_or : 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; + 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 57bd95a1151..07e0c88e209 100644 --- a/gcc/range-op.cc +++ b/gcc/range-op.cc @@ -79,6 +79,7 @@ operator_addr_expr op_addr; operator_bitwise_not op_bitwise_not; operator_bitwise_xor op_bitwise_xor; operator_bitwise_and op_bitwise_and; +operator_bitwise_or op_bitwise_or; // Invoke the initialization routines for each class of range. @@ -117,6 +118,7 @@ unified_table::unified_table () // implementation. These also remain in the pointer table until a pointer // speifc version is provided. set (BIT_AND_EXPR, op_bitwise_and); + set (BIT_IOR_EXPR, op_bitwise_or); } // The tables are hidden and accessed via a simple extern function. @@ -3608,27 +3610,12 @@ operator_logical_or::op2_range (irange &r, tree type, } -class operator_bitwise_or : public range_operator +void +operator_bitwise_or::update_bitmask (irange &r, const irange &lh, + const irange &rh) const { - using range_operator::op1_range; - using range_operator::op2_range; -public: - 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 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; - void update_bitmask (irange &r, const irange &lh, const irange &rh) const - { update_known_bitmask (r, BIT_IOR_EXPR, lh, rh); } -} op_bitwise_or; + update_known_bitmask (r, BIT_IOR_EXPR, lh, rh); +} void operator_bitwise_or::wi_fold (irange &r, tree type, @@ -4549,7 +4536,6 @@ integral_table::integral_table () { set (MIN_EXPR, op_min); set (MAX_EXPR, op_max); - set (BIT_IOR_EXPR, op_bitwise_or); } // Initialize any integral operators to the primary table -- 2.40.1