public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Kyrylo Tkachov <Kyrylo.Tkachov@arm.com>
To: Richard Earnshaw <Richard.Earnshaw@foss.arm.com>,
	"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: RE: [PATCH][committed] aarch64: Suggest an -mcpu option when user passes CPU name to -march
Date: Tue, 6 Sep 2022 09:53:11 +0000	[thread overview]
Message-ID: <PAXPR08MB6926A79D8C6779C07971177C937E9@PAXPR08MB6926.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <ee4321d2-bba6-aaac-e1d3-a95a7c0a546f@foss.arm.com>



> -----Original Message-----
> From: Richard Earnshaw <Richard.Earnshaw@foss.arm.com>
> Sent: Monday, September 5, 2022 2:43 PM
> To: Kyrylo Tkachov <Kyrylo.Tkachov@arm.com>; gcc-patches@gcc.gnu.org
> Subject: Re: [PATCH][committed] aarch64: Suggest an -mcpu option when
> user passes CPU name to -march
> 
> 
> 
> 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?

It'd be good to warn for that too, though I think it's a somewhat less common error.
It can be a separate patch in any case.
Thanks,
Kyrill

> 
> R.

      reply	other threads:[~2022-09-06  9:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-05 13:35 Kyrylo Tkachov
2022-09-05 13:42 ` Richard Earnshaw
2022-09-06  9:53   ` Kyrylo Tkachov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=PAXPR08MB6926A79D8C6779C07971177C937E9@PAXPR08MB6926.eurprd08.prod.outlook.com \
    --to=kyrylo.tkachov@arm.com \
    --cc=Richard.Earnshaw@foss.arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).