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.

Attachment: mcpu.patch
Description: mcpu.patch

Reply via email to