From 7989d512a09d1dd930459b3b0710f22b3def91f4 Mon Sep 17 00:00:00 2001 From: Laytan Laats Date: Mon, 14 Oct 2024 16:19:03 +0200 Subject: add macos 15.0.1 to odin report and core/sys/info --- src/bug_report.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/bug_report.cpp') diff --git a/src/bug_report.cpp b/src/bug_report.cpp index fa7e156ce..c5a8adea3 100644 --- a/src/bug_report.cpp +++ b/src/bug_report.cpp @@ -921,6 +921,7 @@ gb_internal void report_os_info() { {"23G93", {23, 6, 0}, "macOS", {"Sonoma", {14, 6, 1}}}, {"23H124", {23, 6, 0}, "macOS", {"Sonoma", {14, 7, 0}}}, {"24A335", {24, 0, 0}, "macOS", {"Sequoia", {15, 0, 0}}}, + {"24A348", {24, 0, 0}, "macOS", {"Sequoia", {15, 0, 1}}}, }; -- cgit v1.2.3 From 925d8749e030c9dec49a5e27080000a4f950d625 Mon Sep 17 00:00:00 2001 From: Jeroen van Rijn Date: Thu, 7 Nov 2024 12:56:49 +0100 Subject: Suggest `-microarch:native` if `popcnt` instruction is missing. Fixes #4453. --- src/bug_report.cpp | 21 --------------------- src/build_cpuid.cpp | 35 +++++++++++++++++++++++++++++++++++ src/build_settings.cpp | 1 + src/main.cpp | 13 +++++++++++++ 4 files changed, 49 insertions(+), 21 deletions(-) create mode 100644 src/build_cpuid.cpp (limited to 'src/bug_report.cpp') diff --git a/src/bug_report.cpp b/src/bug_report.cpp index c5a8adea3..3f58ebd24 100644 --- a/src/bug_report.cpp +++ b/src/bug_report.cpp @@ -2,12 +2,6 @@ Gather and print platform and version info to help with reporting Odin bugs. */ -#if !defined(GB_COMPILER_MSVC) - #if defined(GB_CPU_X86) - #include - #endif -#endif - #if defined(GB_SYSTEM_LINUX) #include #include @@ -154,21 +148,6 @@ gb_internal void report_windows_product_type(DWORD ProductType) { } #endif -gb_internal void odin_cpuid(int leaf, int result[]) { - #if defined(GB_CPU_ARM) || defined(GB_CPU_RISCV) - return; - - #elif defined(GB_CPU_X86) - - #if defined(GB_COMPILER_MSVC) - __cpuid(result, leaf); - #else - __get_cpuid(leaf, (unsigned int*)&result[0], (unsigned int*)&result[1], (unsigned int*)&result[2], (unsigned int*)&result[3]); - #endif - - #endif -} - gb_internal void report_cpu_info() { gb_printf("\tCPU: "); diff --git a/src/build_cpuid.cpp b/src/build_cpuid.cpp new file mode 100644 index 000000000..a4e44e7f1 --- /dev/null +++ b/src/build_cpuid.cpp @@ -0,0 +1,35 @@ +#if !defined(GB_COMPILER_MSVC) + #if defined(GB_CPU_X86) + #include + #endif +#endif + +gb_internal void odin_cpuid(int leaf, int result[]) { + #if defined(GB_CPU_ARM) || defined(GB_CPU_RISCV) + return; + + #elif defined(GB_CPU_X86) + + #if defined(GB_COMPILER_MSVC) + __cpuid(result, leaf); + #else + __get_cpuid(leaf, (unsigned int*)&result[0], (unsigned int*)&result[1], (unsigned int*)&result[2], (unsigned int*)&result[3]); + #endif + + #endif +} + +gb_internal bool should_use_march_native() { + #if !defined(GB_CPU_X86) + return false; + + #else + + int cpu[4]; + odin_cpuid(0x1, &cpu[0]); // Get feature information in ECX + EDX + + bool have_popcnt = cpu[2] && (1 << 23); // bit 23 in ECX = popcnt + return !have_popcnt; + + #endif +} \ No newline at end of file diff --git a/src/build_settings.cpp b/src/build_settings.cpp index e4413b1fe..142076a70 100644 --- a/src/build_settings.cpp +++ b/src/build_settings.cpp @@ -2,6 +2,7 @@ #include #include #endif +#include "build_cpuid.cpp" // #if defined(GB_SYSTEM_WINDOWS) // #define DEFAULT_TO_THREADED_CHECKER 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 (;;) { -- cgit v1.2.3 From 8f2766c4dccc16277683288fc0d8a8281afa983d Mon Sep 17 00:00:00 2001 From: Laytan Laats Date: Sat, 16 Nov 2024 15:42:13 +0100 Subject: add missing macos version --- core/sys/info/platform_darwin.odin | 15 +++++++++++++++ src/bug_report.cpp | 15 +++++++++++++++ 2 files changed, 30 insertions(+) (limited to 'src/bug_report.cpp') diff --git a/core/sys/info/platform_darwin.odin b/core/sys/info/platform_darwin.odin index 56cd883d3..97a2199ab 100644 --- a/core/sys/info/platform_darwin.odin +++ b/core/sys/info/platform_darwin.odin @@ -494,6 +494,10 @@ macos_release_map: map[string]Darwin_To_Release = { "21G816" = {{21, 6, 0}, "macOS", {"Monterey", {12, 7, 0}}}, "21G920" = {{21, 6, 0}, "macOS", {"Monterey", {12, 7, 1}}}, "21G1974" = {{21, 6, 0}, "macOS", {"Monterey", {12, 7, 2}}}, + "21H1015" = {{21, 6, 0}, "macOS", {"Monterey", {12, 7, 3}}}, + "21H1123" = {{21, 6, 0}, "macOS", {"Monterey", {12, 7, 4}}}, + "21H1222" = {{21, 6, 0}, "macOS", {"Monterey", {12, 7, 5}}}, + "21H1320" = {{21, 6, 0}, "macOS", {"Monterey", {12, 7, 6}}}, // MacOS Ventura "22A380" = {{22, 1, 0}, "macOS", {"Ventura", {13, 0, 0}}}, @@ -513,6 +517,15 @@ macos_release_map: map[string]Darwin_To_Release = { "22G120" = {{22, 6, 0}, "macOS", {"Ventura", {13, 6, 0}}}, "22G313" = {{22, 6, 0}, "macOS", {"Ventura", {13, 6, 1}}}, "22G320" = {{22, 6, 0}, "macOS", {"Ventura", {13, 6, 2}}}, + "22G436" = {{22, 6, 0}, "macOS", {"Ventura", {13, 6, 3}}}, + "22G513" = {{22, 6, 0}, "macOS", {"Ventura", {13, 6, 4}}}, + "22G621" = {{22, 6, 0}, "macOS", {"Ventura", {13, 6, 5}}}, + "22G630" = {{22, 6, 0}, "macOS", {"Ventura", {13, 6, 6}}}, + "22G720" = {{22, 6, 0}, "macOS", {"Ventura", {13, 6, 7}}}, + "22G820" = {{22, 6, 0}, "macOS", {"Ventura", {13, 6, 8}}}, + "22G830" = {{22, 6, 0}, "macOS", {"Ventura", {13, 6, 9}}}, + "22H123" = {{22, 6, 0}, "macOS", {"Ventura", {13, 7, 0}}}, + "22H221" = {{22, 6, 0}, "macOS", {"Ventura", {13, 7, 1}}}, // MacOS Sonoma "23A344" = {{23, 0, 0}, "macOS", {"Sonoma", {14, 0, 0}}}, @@ -531,10 +544,12 @@ macos_release_map: map[string]Darwin_To_Release = { "23G80" = {{23, 6, 0}, "macOS", {"Sonoma", {14, 6, 0}}}, "23G93" = {{23, 6, 0}, "macOS", {"Sonoma", {14, 6, 1}}}, "23H124" = {{23, 6, 0}, "macOS", {"Sonoma", {14, 7, 0}}}, + "23H222" = {{23, 6, 0}, "macOS", {"Sonoma", {14, 7, 1}}}, // MacOS Sequoia "24A335" = {{24, 0, 0}, "macOS", {"Sequoia", {15, 0, 0}}}, "24A348" = {{24, 0, 0}, "macOS", {"Sequoia", {15, 0, 1}}}, + "24B83" = {{24, 1, 0}, "macOS", {"Sequoia", {15, 1, 0}}}, } @(private) diff --git a/src/bug_report.cpp b/src/bug_report.cpp index 3f58ebd24..d4517f9e3 100644 --- a/src/bug_report.cpp +++ b/src/bug_report.cpp @@ -866,6 +866,10 @@ gb_internal void report_os_info() { {"21G816", {21, 6, 0}, "macOS", {"Monterey", {12, 7, 0}}}, {"21G920", {21, 6, 0}, "macOS", {"Monterey", {12, 7, 1}}}, {"21G1974", {21, 6, 0}, "macOS", {"Monterey", {12, 7, 2}}}, + {"21H1015", {21, 6, 0}, "macOS", {"Monterey", {12, 7, 3}}}, + {"21H1123", {21, 6, 0}, "macOS", {"Monterey", {12, 7, 4}}}, + {"21H1222", {21, 6, 0}, "macOS", {"Monterey", {12, 7, 5}}}, + {"21H1320", {21, 6, 0}, "macOS", {"Monterey", {12, 7, 6}}}, {"22A380", {13, 0, 0}, "macOS", {"Ventura", {22, 1, 0}}}, {"22A400", {13, 0, 1}, "macOS", {"Ventura", {22, 1, 0}}}, {"22C65", {13, 1, 0}, "macOS", {"Ventura", {22, 2, 0}}}, @@ -883,6 +887,15 @@ gb_internal void report_os_info() { {"22G120", {13, 6, 0}, "macOS", {"Ventura", {22, 6, 0}}}, {"22G313", {13, 6, 1}, "macOS", {"Ventura", {22, 6, 0}}}, {"22G320", {13, 6, 2}, "macOS", {"Ventura", {22, 6, 0}}}, + {"22G436", {22, 6, 0}, "macOS", {"Ventura", {13, 6, 3}}}, + {"22G513", {22, 6, 0}, "macOS", {"Ventura", {13, 6, 4}}}, + {"22G621", {22, 6, 0}, "macOS", {"Ventura", {13, 6, 5}}}, + {"22G630", {22, 6, 0}, "macOS", {"Ventura", {13, 6, 6}}}, + {"22G720", {22, 6, 0}, "macOS", {"Ventura", {13, 6, 7}}}, + {"22G820", {22, 6, 0}, "macOS", {"Ventura", {13, 6, 8}}}, + {"22G830", {22, 6, 0}, "macOS", {"Ventura", {13, 6, 9}}}, + {"22H123", {22, 6, 0}, "macOS", {"Ventura", {13, 7, 0}}}, + {"22H221", {22, 6, 0}, "macOS", {"Ventura", {13, 7, 1}}}, {"23A344", {23, 0, 0}, "macOS", {"Sonoma", {14, 0, 0}}}, {"23B74", {23, 1, 0}, "macOS", {"Sonoma", {14, 1, 0}}}, {"23B81", {23, 1, 0}, "macOS", {"Sonoma", {14, 1, 1}}}, @@ -899,8 +912,10 @@ gb_internal void report_os_info() { {"23G80", {23, 6, 0}, "macOS", {"Sonoma", {14, 6, 0}}}, {"23G93", {23, 6, 0}, "macOS", {"Sonoma", {14, 6, 1}}}, {"23H124", {23, 6, 0}, "macOS", {"Sonoma", {14, 7, 0}}}, + {"23H222", {23, 6, 0}, "macOS", {"Sonoma", {14, 7, 1}}}, {"24A335", {24, 0, 0}, "macOS", {"Sequoia", {15, 0, 0}}}, {"24A348", {24, 0, 0}, "macOS", {"Sequoia", {15, 0, 1}}}, + {"24B83", {24, 1, 0}, "macOS", {"Sequoia", {15, 1, 0}}}, }; -- cgit v1.2.3