From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 4E7D63858CDA for ; Mon, 5 Sep 2022 13:42:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4E7D63858CDA Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=foss.arm.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=foss.arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3FCECED1; Mon, 5 Sep 2022 06:43:00 -0700 (PDT) Received: from [10.2.78.56] (unknown [10.2.78.56]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 881523F7B4; Mon, 5 Sep 2022 06:42:53 -0700 (PDT) Message-ID: Date: Mon, 5 Sep 2022 14:42:52 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH][committed] aarch64: Suggest an -mcpu option when user passes CPU name to -march Content-Language: en-GB To: Kyrylo Tkachov , "gcc-patches@gcc.gnu.org" References: From: Richard Earnshaw In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3491.0 required=5.0 tests=BAYES_00,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,KAM_SHORT,NICE_REPLY_A,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 List-Id: On 05/09/2022 14:35, Kyrylo Tkachov via Gcc-patches wrote: > Hi all, > > This small patch helps users who confuse -march and -mcpu on AArch64. > Sometimes users pass -march with a CPU name, where they most likely wanted to > use -mcpu, which would select the right architecture features *and* tune for > their desired CPU. Currently we'll just error out with an unkown architecture > message and list the valid architecture options. > With this patch we check if their string matches a known CPU and suggest they > use an -mcpu option instead. > > So compiling with -march=neoverse-n1 will now give the error: > cc1: error: unknown value 'neoverse-n1' for '-march' > cc1: note: valid arguments are: armv8-a armv8.1-a armv8.2-a armv8.3-a armv8.4-a armv8.5-a armv8.6-a armv8.7-a armv8.8-a armv8-r armv9-a > cc1: note: did you mean '-mcpu=neoverse-n1'? > > Bootstrapped and tested on aarch64-none-linux-gnu. > Pushing to trunk. > Thanks, > Kyrill > > gcc/ChangeLog: > > * config/aarch64/aarch64.cc (aarch64_validate_march): Check if invalid arch > string is a valid -mcpu string and emit hint. > > gcc/testsuite/ChangeLog: > > * gcc.target/aarch64/spellcheck_10.c: New test. What about the reverse case, passing an architecture to -mcpu? R.