aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorJeroen van Rijn <Kelimion@users.noreply.github.com>2024-11-07 12:56:49 +0100
committerJeroen van Rijn <Kelimion@users.noreply.github.com>2024-11-07 12:56:49 +0100
commit925d8749e030c9dec49a5e27080000a4f950d625 (patch)
tree5b6d409dbfee79ec99dcd3ab554c4c4479084588 /src/main.cpp
parentfd442b8678baa63be60c3c555d6063386e1d7453 (diff)
Suggest `-microarch:native` if `popcnt` instruction is missing.
Fixes #4453.
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index b04ee90f1..e65f866a1 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -3321,6 +3321,19 @@ int main(int arg_count, char const **arg_ptr) {
}
}
+ #if defined(GB_CPU_X86)
+ // We've detected that the CPU doesn't support popcnt, or another reason to use `-microarch:native`,
+ // and that no custom microarch was chosen.
+ if (should_use_march_native() && march == get_default_microarchitecture()) {
+ if (command == "run" || command == "test") {
+ gb_printf_err("Error: Try using '-microarch:native' as Odin defaults to %.*s (close to Nehalem) by default and your CPU seems to be a much older CPU.\n", LIT(march));
+ gb_exit(1);
+ } else if (command == "build") {
+ gb_printf("Suggestion: Try using '-microarch:native' as Odin defaults to %.*s (close to Nehalem) by default and your CPU seems to be a much older CPU.\n", LIT(march));
+ }
+ }
+ #endif
+
if (build_context.target_features_string.len != 0) {
String_Iterator target_it = {build_context.target_features_string, 0};
for (;;) {