* [PATCH][committed] aarch64: Give hint for -mcpu options that match -march instead
@ 2023-04-18 11:15 Kyrylo Tkachov
0 siblings, 0 replies; only message in thread
From: Kyrylo Tkachov @ 2023-04-18 11:15 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 457 bytes --]
Hi all,
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.
Pushing to trunk.
Thanks,
Kyrill
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.
[-- Attachment #2: arch-hint.patch --]
[-- Type: application/octet-stream, Size: 1666 bytes --]
diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
index 3a2b636d948c55d6477cedc796e0bc35a257286a..f070218eca1130d5a2b8f3788ce2f2018eea22af 100644
--- a/gcc/config/aarch64/aarch64.cc
+++ b/gcc/config/aarch64/aarch64.cc
@@ -18080,6 +18080,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 0000000000000000000000000000000000000000..a278328cabc486c5ff1304139b0b4cda72ebe4f8
--- /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 } */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-04-18 11:15 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-18 11:15 [PATCH][committed] aarch64: Give hint for -mcpu options that match -march instead Kyrylo Tkachov
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).