]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
cpu-supports: support checks on any architecture
authorPádraig Brady <P@draigBrady.com>
Wed, 17 Sep 2025 18:09:54 +0000 (19:09 +0100)
committerPádraig Brady <P@draigBrady.com>
Wed, 17 Sep 2025 19:37:24 +0000 (20:37 +0100)
* 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.

ChangeLog
lib/cpu-supports.h

index a934b4507ac1d324b0622530e43eefe7be42d647..beab05d8114b22d936ac877541217503b7997c84 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2025-09-17  Pádraig Brady  <P@draigBrady.com>
+
+       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  <P@draigBrady.com>
 
        tests: support -ftrivial-auto-var-init
index 8905680d09ffe5b74213a4d2bb2c779c29b7cff6..c0ad83866fed4ec53278e439639966e5f11262de 100644 (file)
@@ -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;
 }