From: Pádraig Brady Date: Wed, 17 Sep 2025 18:09:54 +0000 (+0100) Subject: cpu-supports: support checks on any architecture X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=395bd7a734a1c0beb4daa25130c4a1cdfad5719d;p=thirdparty%2Fgnulib.git cpu-supports: support checks on any architecture * lib/cpu-supports.h (gcc_feature_to_glibc_hwcap): Define the map for all architectures, because for example one can build and detect and run x86_64 intrinsics in code built with -m32. This should not add runtime overhead, as mentioned previously the map resolves at compile time with standard optimizations. --- diff --git a/ChangeLog b/ChangeLog index a934b4507a..beab05d811 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2025-09-17 Pádraig Brady + + cpu-supports: support checks on any architecture + * lib/cpu-supports.h (gcc_feature_to_glibc_hwcap): Define the + map for all architectures, because for example one can build + and detect and run x86_64 intrinsics in code built with -m32. + This should not add runtime overhead, as mentioned previously + the map resolves at compile time with standard optimizations. + 2025-09-17 Pádraig Brady tests: support -ftrivial-auto-var-init diff --git a/lib/cpu-supports.h b/lib/cpu-supports.h index 8905680d09..c0ad83866f 100644 --- a/lib/cpu-supports.h +++ b/lib/cpu-supports.h @@ -61,18 +61,16 @@ gcc_feature_to_glibc_hwcap (char const *feature) { char const *hwcap = NULL; - if (0) - ; -# if defined __x86_64__ + if (0) {} + /* x64_64 */ else if (streq (feature, "avx")) hwcap = "-AVX"; else if (streq (feature, "avx2")) hwcap = "-AVX2"; else if (streq (feature, "avx512bw")) hwcap = "-AVX512BW"; else if (streq (feature, "avx512f")) hwcap = "-AVX512F"; else if (streq (feature, "pclmul")) hwcap = "-PCLMULQDQ"; else if (streq (feature, "vpclmulqdq")) hwcap = "-VPCLMULQDQ"; -# elif defined __aarch64__ + /* aarch64 */ else if (streq (feature, "pmull")) hwcap = "-PMULL"; -# endif return hwcap; }