From patchwork Wed Jul 26 08:42:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 1813030 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=server2.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=ZPfqj37i; dkim-atps=neutral Received: from server2.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 4R9nVB4jT1z1yYc for ; Wed, 26 Jul 2023 18:43:14 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 77B273857C43 for ; Wed, 26 Jul 2023 08:43:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 77B273857C43 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1690360992; bh=5lT+/tGmD4SrYEHrpNW+fvM/roBBT6E9eTyB6D1jw0s=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=ZPfqj37ikOGCNIvMEDMyQ0HktoXhvW80BsIg2nMVCrrnQyvUHUX1ETtY27TK8LLum K2wZJdru6JjjgAY+dfTmMaBqPFWCqacCLYDHND7hegT+6tHsQFhGn7DQ1hjzntZckm AoPxVQGI7UjDAsF6k9zM8GjFLuNTlKoK5UX7ms98= 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 847193858023 for ; Wed, 26 Jul 2023 08:42:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 847193858023 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-592-M1ubJq4tOjeadlbNX727Ug-1; Wed, 26 Jul 2023 04:42:36 -0400 X-MC-Unique: M1ubJq4tOjeadlbNX727Ug-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1140A185A795 for ; Wed, 26 Jul 2023 08:42:36 +0000 (UTC) Received: from abulafia.quesejoda.com (unknown [10.39.193.103]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9D9E1F782E; Wed, 26 Jul 2023 08:42:35 +0000 (UTC) Received: from abulafia.quesejoda.com (localhost [127.0.0.1]) by abulafia.quesejoda.com (8.17.1/8.17.1) with ESMTPS id 36Q8gXNw043442 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 26 Jul 2023 10:42:33 +0200 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.17.1/8.17.1/Submit) id 36Q8gX3I043441; Wed, 26 Jul 2023 10:42:33 +0200 To: GCC patches Cc: Andrew MacLeod , Aldy Hernandez Subject: [COMMITTED] [range-ops] Handle bitmasks for BIT_NOT_EXPR. Date: Wed, 26 Jul 2023 10:42:16 +0200 Message-ID: <20230726084224.43416-2-aldyh@redhat.com> In-Reply-To: <20230726084224.43416-1-aldyh@redhat.com> References: <20230726084224.43416-1-aldyh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.4 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_H4, 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: Aldy Hernandez via Gcc-patches From: Aldy Hernandez Reply-To: Aldy Hernandez Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" gcc/ChangeLog: * range-op-mixed.h (class operator_bitwise_not): Add update_bitmask. * range-op.cc (operator_bitwise_not::update_bitmask): New. --- gcc/range-op-mixed.h | 2 ++ gcc/range-op.cc | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/gcc/range-op-mixed.h b/gcc/range-op-mixed.h index 6944742ecbc..ead41ed0515 100644 --- a/gcc/range-op-mixed.h +++ b/gcc/range-op-mixed.h @@ -551,6 +551,8 @@ public: bool op1_range (irange &r, tree type, const irange &lhs, const irange &op2, relation_trio rel = TRIO_VARYING) const final override; + void update_bitmask (irange &r, const irange &lh, + const irange &rh) const final override; }; class operator_bitwise_xor : public range_operator diff --git a/gcc/range-op.cc b/gcc/range-op.cc index d959a3e93dc..13ba973a08d 100644 --- a/gcc/range-op.cc +++ b/gcc/range-op.cc @@ -4027,6 +4027,13 @@ operator_bitwise_not::op1_range (irange &r, tree type, return fold_range (r, type, lhs, op2); } +void +operator_bitwise_not::update_bitmask (irange &r, const irange &lh, + const irange &rh) const +{ + update_known_bitmask (r, BIT_NOT_EXPR, lh, rh); +} + bool operator_cst::fold_range (irange &r, tree type ATTRIBUTE_UNUSED,