diff options
author | Kyrylo Tkachov <kyrylo.tkachov@arm.com> | 2023-04-18 12:15:35 +0100 |
---|---|---|
committer | Kyrylo Tkachov <kyrylo.tkachov@arm.com> | 2023-04-18 12:15:35 +0100 |
commit | ebaec582ca1ee33269724bff945a16655e487ad5 (patch) | |
tree | e67510c444dd16fd8ec50b641e1503a4741f1392 /gcc | |
parent | 2d70f3213fe4e76722cd55e48f8eb0820c56ec7a (diff) | |
download | gcc-ebaec582ca1ee33269724bff945a16655e487ad5.zip gcc-ebaec582ca1ee33269724bff945a16655e487ad5.tar.gz gcc-ebaec582ca1ee33269724bff945a16655e487ad5.tar.bz2 |
aarch64: Give hint for -mcpu options that match -march instead
We should redirect users of the erroneous -mcpu=armv8.2-a to use -march instead.
There is an equivalent hint for -march used with a CPU name.
Bootstrapped and tested on aarch64-none-linux-gnu.
gcc/ChangeLog:
* config/aarch64/aarch64.cc (aarch64_validate_mcpu): Add hint to use -march
if the argument matches that.
gcc/testsuite/ChangeLog:
* gcc.target/aarch64/spellcheck_11.c: New test.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/config/aarch64/aarch64.cc | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/aarch64/spellcheck_11.c | 13 |
2 files changed, 19 insertions, 0 deletions
diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index 0f04ab9..adbdaaf 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -18139,6 +18139,12 @@ aarch64_validate_mcpu (const char *str, const struct processor **res, case AARCH_PARSE_INVALID_ARG: error ("unknown value %qs for %<-mcpu%>", str); aarch64_print_hint_for_core (str); + /* A common user error is confusing -march and -mcpu. + If the -mcpu string matches a known architecture then suggest + -march=. */ + parse_res = aarch64_parse_arch (str, res, isa_flags, &invalid_extension); + if (parse_res == AARCH_PARSE_OK) + inform (input_location, "did you mean %<-march=%s%>?", str); break; case AARCH_PARSE_INVALID_FEATURE: error ("invalid feature modifier %qs in %<-mcpu=%s%>", diff --git a/gcc/testsuite/gcc.target/aarch64/spellcheck_11.c b/gcc/testsuite/gcc.target/aarch64/spellcheck_11.c new file mode 100644 index 0000000..a278328 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/spellcheck_11.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-skip-if "" { *-*-* } { "-march=*" } { "" } } */ +/* { dg-skip-if "" { *-*-* } { "-mcpu=*" } { "" } } */ +/* { dg-options "-mcpu=armv8.2-a+dotprod" } */ + +void +foo () +{ +} + +/* { dg-error "unknown value .armv8.2-a\\+dotprod. for .-mcpu." "" { target *-*-* } 0 } */ +/* { dg-message "valid arguments are: \[^\n\r]*" "" { target *-*-* } 0 } */ +/* { dg-message "did you mean .-march=armv8.2-a\\+dotprod.?" "" { target *-*-* } 0 } */ |