From patchwork Fri Nov 24 14:55:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 169452 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp1265041vqx; Fri, 24 Nov 2023 06:56:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IEcpyaNRxtBvvrIZ7pUCTWewctT6JBlmkRNEJFAp1h7CqdMuMYTqxw4gI/w0+6k9bamT4t1 X-Received: by 2002:a05:620a:8793:b0:77c:1d29:bf86 with SMTP id py19-20020a05620a879300b0077c1d29bf86mr2767524qkn.44.1700837791977; Fri, 24 Nov 2023 06:56:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700837791; cv=pass; d=google.com; s=arc-20160816; b=tikXbVOM4qylLe69kJgb4nRJea4LbY+px+va0+eoBihaXrVIveIV9hr0UTDOUtzEUg Z3t3NhV1yCW2NWeo9ZXUiA+tRxh3OOFcyVn+6TyeoVdMoOIkFk4hKrET+UiLYWtWrmsw V1ybb/UzQIxz33efgELCPngqzVh8prpQkGUkJiBFCkwoIaZKPQUZGy9/khjGlCgaaTRI bAXbfINBGOpDTSrLBLvd9E0vh6i+JYVq/LZfEWVpfE4l8nmiTQC1tfvgydk7iWKGRBOV kQQ2gDkodUkoY37k1e3RmkyxooB9TNPeYJyjHkR31yVaqp73she8TZLZLs5vc6eccmEe h8xA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version:message-id:date :user-agent:references:in-reply-to:subject:to:from:ironport-sdr :arc-filter:dmarc-filter:delivered-to; bh=1M3rmki2LsULFrov7l7En4vSw3Nha3yJuBwer9SrCCA=; fh=kdJPaF1aotkSq0HW2mPxW0QJzqYm9bjBTV6w+6VApEM=; b=DaghhXApjjaWBRTk+yLqrWEAY85QdiGXjMdqnr9PDsMHOqhS1QT7Y00JMrcrVrAJWP t7U2i161Sqr0YY9lc2mDFBJksbu2sXHAZnMSks31JbtrcVOTLfvL4GvldPWY0R/HAx5Q O+5VFjxv/fogTpFXReKZbVJ4iwbQallI9Q+OWuFM5x/9iiNrkCG2UlrchkDu4h5O3OWs /ROcU0pwygaLruXc5U3odX6rM42LVKRVSiK/Gx1fY10rHb9FBRv5+I7HtsSe1XS3+j6c p88kVMSUv7HIvLZQXWOAjThh+SasNvY59yA9SwvreJQaCOTM5iU6wcSEMHw6ktRR6mOk Cc+A== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id e13-20020a37ac0d000000b007759f94721asi3247129qkm.209.2023.11.24.06.56.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Nov 2023 06:56:31 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BC12138582B9 for ; Fri, 24 Nov 2023 14:56:31 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa2.mentor.iphmx.com (esa2.mentor.iphmx.com [68.232.141.98]) by sourceware.org (Postfix) with ESMTPS id ECB183858D3C for ; Fri, 24 Nov 2023 14:56:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ECB183858D3C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org ECB183858D3C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=68.232.141.98 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700837765; cv=none; b=A6OMigL4r5I045X8W8LBTzDdXXqA9fbc0w2YsppkfLte9PEHLjkHic7UzLNzPkfoADs5kbhAjStS74mX/xGlnQRopMFn+p12xCQPxFqng7aTRpDMskX/nVlP2m2Ee6lwJfTlOj3bBv2ra0AwO/hpW8bMFfwPHdZ8nhvdl9vzrwc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700837765; c=relaxed/simple; bh=Tl9cYnilhh/jdK9tHhQJmgOOMPes6tibrgZ2BTwoiOQ=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=VcI25vBvAWK4t6r2Zr7adeLScA+MPcOXEG0C/Dq2viT4JF1Qf3GhBsE6Rkv9MCHpvQB66ef+LK0HhHetM7vn0gcceXmO4glz9WDS33ADTAIgRGUoQLwM1qMDLzrGHL6fObo23KaijCuxJsQyTEquyciYZrplUcA0t+bP7UY6b00= ARC-Authentication-Results: i=1; server2.sourceware.org X-CSE-ConnectionGUID: 3RI9QoIrT7qCamSJ4Wh8vA== X-CSE-MsgGUID: fAEeY49hQzuif3Gexhol9g== X-IronPort-AV: E=Sophos;i="6.04,224,1695715200"; d="scan'208,223";a="26443892" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa2.mentor.iphmx.com with ESMTP; 24 Nov 2023 06:56:01 -0800 IronPort-SDR: CoTMd6PD3zPbbQVDdqT1zGylKj2KHWjJxHMHiBmWgMPWL9/7jjkpr6/88ymtRPTq+Dk0M336sT gpGL8tsegqBztSE145K8e8TDqHvBDatoWIQS6Sf8H8bhGmL7uLQKaezWPjAYWPdoQECAOHDMYV mImplvMwYDm6236crWLkNCGre6B6DWl+YVi8Oc7X+c2/yWP+3ikxkcjQhF6frvlv9Qmj9MIrX9 ZRI+iKrdaFXc3OJrpv4L08LeUnH5FT1HkbA9ehFqEXkootYQUHWXl/+UPUmf60zM8IGgJGk9Aw ttI= From: Thomas Schwinge To: Andrew Stubbs , Julian Brown , , Joseph Myers Subject: GCN: Tag '-march=[...]', '-mtune=[...]' as 'Negative' of themselves [PR112669] (was: [gcn][patch] Add -mgpu option and plumb in assembler/linker) In-Reply-To: References: <20170529172734.f4gtlrhkg2ovtwve@virgil.suse.cz> <8189798b-48e3-7f72-5976-53ea947adc10@mentor.com> User-Agent: Notmuch/0.29.3+94~g74c3f1b (https://notmuchmail.org) Emacs/28.2 (x86_64-pc-linux-gnu) Date: Fri, 24 Nov 2023 15:55:52 +0100 Message-ID: <87v89rryiv.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-12.mgc.mentorg.com (139.181.222.12) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_LOTSOFHASH, SPF_HELO_PASS, SPF_PASS, 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783457688407450249 X-GMAIL-MSGID: 1783457688407450249 Hi! On 2017-06-21T11:06:24+0100, Andrew Stubbs wrote: > --- a/gcc/config/gcn/gcn.opt > +++ b/gcc/config/gcn/gcn.opt > +march= > +Target RejectNegative Joined ToLower Enum(gpu_type) Var(gcn_arch) Init(PROCESSOR_CARRIZO) > +Specify the name of the target GPU. > + > +mtune= > +Target RejectNegative Joined ToLower Enum(gpu_type) Var(gcn_tune) Init(PROCESSOR_CARRIZO) > +Specify the name of the target GPU. OK to push the attached "GCN: Tag '-march=[...]', '-mtune=[...]' as 'Negative' of themselves [PR112669]"? For reference, see also: - [...] - commit 718a3eab2906217c70f27077446fa0e8ddb1bf7b "[arm] Mark -marm and -mthumb as being inverse options" - commit aebe10d48ccc217273ee8a4e2c3805ed1e173a78 "driver: Also prune joined switches with negation" ['gcc/config/i386/i386.opt'] - commit 6fdbe41963a7aecad80f27e9805c7e18cbd4ab48 "driver: Also prune joined switches with negation" ['gcc/config/aarch64/aarch64.opt', 'gcc/config/arm/arm.opt'] - commit 17f2908fcf058e145cff275966e34f8c7f57c2c5 "RISC-V: For '-march' and '-mabi' options, add 'Negative' property mentions itself" - commit 69c426b89579312af91035c26fb1e270bfbcad00 "doc/options.texi: Fix the description of 'Negative'" (..., and yes, GCC/nvptx does need similar treatment...) Grüße Thomas ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955 From 0e03aa39bd5fbae8a5993bf9bf6dad34f9e85c2d Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Wed, 22 Nov 2023 17:35:23 +0100 Subject: [PATCH] GCN: Tag '-march=[...]', '-mtune=[...]' as 'Negative' of themselves [PR112669] Certain other command-line flags are mutually exclusive (random example: GCN '-march=gfx906', '-march=gfx908'). If they're not appropriately marked up, this does disturb the multilib selection machinery, for example: $ build-gcc-offload-amdgcn-amdhsa/gcc/xgcc -print-multi-directory -march=gfx906 gfx906 $ build-gcc-offload-amdgcn-amdhsa/gcc/xgcc -print-multi-directory -march=gfx908 gfx908 $ build-gcc-offload-amdgcn-amdhsa/gcc/xgcc -print-multi-directory -march=gfx906 -march=gfx908 . In the last invocation, '-march=gfx900 -march=gfx906', for example, in 'gcc/gcc.cc:set_multilib_dir' we see both flags -- which there doesn't exist a matching multilib for, therefore we "fail" to the default ('.'). Tagges as 'Negative', only the last flag survives, and we, for example, get the expected: $ build-gcc-offload-amdgcn-amdhsa/gcc/xgcc -print-multi-directory -march=gfx906 -march=gfx908 gfx908 I quickly found that the same also applies to GCN's '-mtune=[...]', but I've not otherwise reviewed the GCN options. PR target/112669 gcc/ * config/gcn/gcn.opt (march=, mtune=): Tag as 'Negative' of themselves. --- gcc/config/gcn/gcn.opt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/config/gcn/gcn.opt b/gcc/config/gcn/gcn.opt index 7a852c51c84..e5db6df92d7 100644 --- a/gcc/config/gcn/gcn.opt +++ b/gcc/config/gcn/gcn.opt @@ -44,11 +44,11 @@ EnumValue Enum(gpu_type) String(gfx1030) Value(PROCESSOR_GFX1030) march= -Target RejectNegative Joined ToLower Enum(gpu_type) Var(gcn_arch) Init(PROCESSOR_FIJI) +Target RejectNegative Negative(march=) Joined ToLower Enum(gpu_type) Var(gcn_arch) Init(PROCESSOR_FIJI) Specify the name of the target GPU. mtune= -Target RejectNegative Joined ToLower Enum(gpu_type) Var(gcn_tune) Init(PROCESSOR_FIJI) +Target RejectNegative Negative(mtune=) Joined ToLower Enum(gpu_type) Var(gcn_tune) Init(PROCESSOR_FIJI) Specify the name of the target GPU. m32 -- 2.34.1