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%>",
--- /dev/null
+/* { 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 } */