Message ID | 20230824191455.3547513-3-apinski@marvell.com |
---|---|
State | Unresolved |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a7d1:0:b0:3f2:4152:657d with SMTP id p17csp1335923vqm; Thu, 24 Aug 2023 12:17:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGZIj761gdX+7oy12flXdkqY/CyXeF+kaN+eDtjyn8yYDJogqUzdy9bj2yGOXuOfD9TYO3h X-Received: by 2002:a05:6402:b04:b0:525:ce69:b52d with SMTP id bm4-20020a0564020b0400b00525ce69b52dmr12206296edb.39.1692904622306; Thu, 24 Aug 2023 12:17:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692904622; cv=none; d=google.com; s=arc-20160816; b=YnECMqNkIdbpKhHYnT0mJF8RuDgBHexne6QFQfcgUMxr86ODRftm7rwtw+iRd94WB4 2Q7kGpd71f9Gnbpdb0EnUfHLcOLLGtuJ3apSBd27BloHaVur1CGpGYUL9UazY0ZSPIq6 4NW29sWL1GZRu8tHOAx3lF93AvacUlEZAM7x3r3H2H37clOTOMKLNVw7BBkycBBLIxnC QdiU2jqxPOFYJmKtEyQd78I/H1MpAAEU7UBzf16y/NnApKlCSRl1vnM5IDwz+vdt1qV6 lmuYhdlxRMK0msV59puYPyp/o3qFioQjvSrRx8P7H1U67MQFtSJ70LcrfVvyiGAlUN67 J/1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=iHs8w/HrqfwP78VSTBWHRh+e6H2nspgm7cZoMYvbC+8=; fh=XbcmRug6/SzczusyoNU1I7Lu5oY0AN2u0mWDzKoxdSs=; b=SVyU26v6FSbiXdB9l74pUDhRqMFhHlcNb2e6+8B+oAWJ2Z0uSU87Au7aNQLTKL4UNL LFhjQqoDfKCIQsDBD5qn98yvkVSPrQiVgHHMKQGT2lm/VcCe6tQohV+vwcJVf+0V0e/S J4CSWJzg9PeUv98d6+xY1nDCkkfxVLxf9P4fVJxc1pk0nB/UTG+Pp019KieueODsjLjh pOonjWtbTaX5fGWa0J6rsPybUZws1q8GRejqIiZycwbztTPa5ynBh/U+DrBirl5LZ+OB J7TsmzQ/WRYk/tojoFsK+6ggNwei+NKU4R0bHgVn8irQ2Ab7GXtqHYUK13gzJF67Z0EW BRYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=xHFGF05L; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id j15-20020a50ed0f000000b0052328d01e51si115925eds.407.2023.08.24.12.17.02 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Aug 2023 12:17:02 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=xHFGF05L; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 31B0D38319F8 for <ouuuleilei@gmail.com>; Thu, 24 Aug 2023 19:16:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 31B0D38319F8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1692904560; bh=iHs8w/HrqfwP78VSTBWHRh+e6H2nspgm7cZoMYvbC+8=; 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=xHFGF05L0BQys3az7m46QAdBpL4GjI6dhQBE9ER45NtrZ64NXQbZGPBwE9na9k39m wMrc2bpnlzQadlhrsUZme51IOCBGFskMXlVXxoBTRmkOyI8aS3cmCMq8qKMvxc1aWU eGIFXY3Ex1BwXZMtFv0keoZbbFKrvAhhRwou+bAw= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by sourceware.org (Postfix) with ESMTPS id BECAA3857027 for <gcc-patches@gcc.gnu.org>; Thu, 24 Aug 2023 19:15:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BECAA3857027 Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 37OFgOAC012153 for <gcc-patches@gcc.gnu.org>; Thu, 24 Aug 2023 12:15:08 -0700 Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3sn20d14u9-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for <gcc-patches@gcc.gnu.org>; Thu, 24 Aug 2023 12:15:08 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Thu, 24 Aug 2023 12:15:04 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Thu, 24 Aug 2023 12:15:04 -0700 Received: from vpnclient.wrightpinski.org.com (unknown [10.69.242.187]) by maili.marvell.com (Postfix) with ESMTP id 613D23F707D; Thu, 24 Aug 2023 12:15:04 -0700 (PDT) To: <gcc-patches@gcc.gnu.org> CC: Andrew Pinski <apinski@marvell.com> Subject: [PATCH 3/3] PHIOPT: Allow BIT_AND and BIT_IOR in early phiopt Date: Thu, 24 Aug 2023 12:14:55 -0700 Message-ID: <20230824191455.3547513-3-apinski@marvell.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230824191455.3547513-1-apinski@marvell.com> References: <20230824191455.3547513-1-apinski@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: 0m5GYBZXbKE5rICc8wqXzf4EKxpHqL5g X-Proofpoint-ORIG-GUID: 0m5GYBZXbKE5rICc8wqXzf4EKxpHqL5g X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-08-24_15,2023-08-24_01,2023-05-22_02 X-Spam-Status: No, score=-14.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP 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 <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: Andrew Pinski via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: Andrew Pinski <apinski@marvell.com> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1775139157266261935 X-GMAIL-MSGID: 1775139157266261935 |
Series |
[1/3] MATCH: Move `a ? one_zero : one_zero` matching after min/max matching
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | warning | Git am fail log |
Commit Message
Andrew Pinski
Aug. 24, 2023, 7:14 p.m. UTC
Now that MIN/MAX can sometimes be transformed into BIT_AND/BIT_IOR, we should allow BIT_AND and BIT_IOR in the early phiopt. Also we produce BIT_AND/BIT_IOR for things like `bool0 ? bool1 : 0` which seems like a good thing to allow early on too. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. gcc/ChangeLog: * tree-ssa-phiopt.cc (phiopt_early_allow): Allow BIT_AND_EXPR and BIT_IOR_EXPR. --- gcc/tree-ssa-phiopt.cc | 3 +++ 1 file changed, 3 insertions(+)
Comments
On Thu, Aug 24, 2023 at 9:16 PM Andrew Pinski via Gcc-patches <gcc-patches@gcc.gnu.org> wrote: > > Now that MIN/MAX can sometimes be transformed into BIT_AND/BIT_IOR, > we should allow BIT_AND and BIT_IOR in the early phiopt. > Also we produce BIT_AND/BIT_IOR for things like `bool0 ? bool1 : 0` > which seems like a good thing to allow early on too. Hum. I think if we allow AND/IOR we should also allow XOR and NOT. Can you add dumping for replacements we disallow? I'm esp. curious for those otherwise being "singleton". I know when doing early phiopt I wanted to be very conservative (also to reduce testsuite fallout), and I was mostly interested in MIN/MAX which I then extended to similar things like ABS. But maybe we can revisit this if we understand which cases we definitely do not want to do early? > OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. > > gcc/ChangeLog: > > * tree-ssa-phiopt.cc (phiopt_early_allow): Allow > BIT_AND_EXPR and BIT_IOR_EXPR. > --- > gcc/tree-ssa-phiopt.cc | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc > index 54706f4c7e7..7e63fb115db 100644 > --- a/gcc/tree-ssa-phiopt.cc > +++ b/gcc/tree-ssa-phiopt.cc > @@ -469,6 +469,9 @@ phiopt_early_allow (gimple_seq &seq, gimple_match_op &op) > { > case MIN_EXPR: > case MAX_EXPR: > + /* MIN/MAX could be convert into these. */ > + case BIT_IOR_EXPR: > + case BIT_AND_EXPR: > case ABS_EXPR: > case ABSU_EXPR: > case NEGATE_EXPR: > -- > 2.31.1 >
On Thu, Aug 24, 2023 at 11:47 PM Richard Biener via Gcc-patches <gcc-patches@gcc.gnu.org> wrote: > > On Thu, Aug 24, 2023 at 9:16 PM Andrew Pinski via Gcc-patches > <gcc-patches@gcc.gnu.org> wrote: > > > > Now that MIN/MAX can sometimes be transformed into BIT_AND/BIT_IOR, > > we should allow BIT_AND and BIT_IOR in the early phiopt. > > Also we produce BIT_AND/BIT_IOR for things like `bool0 ? bool1 : 0` > > which seems like a good thing to allow early on too. > > Hum. > > I think if we allow AND/IOR we should also allow XOR and NOT. Yes, XOR and NOT most likely should be added too. Maybe even comparisons without a conversion too. > > Can you add dumping for replacements we disallow? I'm esp. curious > for those otherwise being "singleton". I know when doing early phiopt > I wanted to be very conservative (also to reduce testsuite fallout), and > I was mostly interested in MIN/MAX which I then extended to similar > things like ABS. But maybe we can revisit this if we understand which > cases we definitely do not want to do early? I have a patch which prints out the dumping of the result and will submit it later today. In the next couple of days I will look into the dump when compiling GCC to see if there are others that seem fine. It might be the case where we want to reject only non single statement ones (except for MIN/MAX were allowing 2 there too). Thanks, Andrew > > > OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. > > > > gcc/ChangeLog: > > > > * tree-ssa-phiopt.cc (phiopt_early_allow): Allow > > BIT_AND_EXPR and BIT_IOR_EXPR. > > --- > > gcc/tree-ssa-phiopt.cc | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc > > index 54706f4c7e7..7e63fb115db 100644 > > --- a/gcc/tree-ssa-phiopt.cc > > +++ b/gcc/tree-ssa-phiopt.cc > > @@ -469,6 +469,9 @@ phiopt_early_allow (gimple_seq &seq, gimple_match_op &op) > > { > > case MIN_EXPR: > > case MAX_EXPR: > > + /* MIN/MAX could be convert into these. */ > > + case BIT_IOR_EXPR: > > + case BIT_AND_EXPR: > > case ABS_EXPR: > > case ABSU_EXPR: > > case NEGATE_EXPR: > > -- > > 2.31.1 > >
diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc index 54706f4c7e7..7e63fb115db 100644 --- a/gcc/tree-ssa-phiopt.cc +++ b/gcc/tree-ssa-phiopt.cc @@ -469,6 +469,9 @@ phiopt_early_allow (gimple_seq &seq, gimple_match_op &op) { case MIN_EXPR: case MAX_EXPR: + /* MIN/MAX could be convert into these. */ + case BIT_IOR_EXPR: + case BIT_AND_EXPR: case ABS_EXPR: case ABSU_EXPR: case NEGATE_EXPR: