summaryrefslogtreecommitdiff
path: root/src/lib/eina/eina_cpu.c
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2018-11-22 16:59:47 +0000
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2018-12-03 11:04:27 +0000
commit168fec6995d526764126080d46e7890aff2a6e7b (patch)
treec38e46bfafc48a93b0990f82f872c9fe3fb307b8 /src/lib/eina/eina_cpu.c
parente2972420c15737e5709f6c4ee4a30de1fdc4c7e5 (diff)
downloadefl-168fec6995d526764126080d46e7890aff2a6e7b.tar.gz
eina+evas cpu - add theoretical SVE support
SVE is a new-ish ARM vector instruction set like neon... but with wider vectors (and variable vector sizes). this adds the flags and hwcaps checks.
Diffstat (limited to 'src/lib/eina/eina_cpu.c')
-rw-r--r--src/lib/eina/eina_cpu.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/lib/eina/eina_cpu.c b/src/lib/eina/eina_cpu.c
index f12bec0fa8..45b3b9295d 100644
--- a/src/lib/eina/eina_cpu.c
+++ b/src/lib/eina/eina_cpu.c
@@ -49,7 +49,7 @@
#include "eina_log.h"
#include "eina_cpu.h"
-#if defined(HAVE_SYS_AUXV_H) && defined(HAVE_ASM_HWCAP_H) && defined(__arm__) && defined(__linux__)
+#if defined(HAVE_SYS_AUXV_H) && defined(HAVE_ASM_HWCAP_H) && (defined(__arm__) || defined(__aarch64__)) && defined(__linux__)
# include <sys/auxv.h>
# include <asm/hwcap.h>
#endif
@@ -126,7 +126,7 @@ void _x86_simd(Eina_Cpu_Features *features)
}
#endif
-#if defined(HAVE_SYS_AUXV_H) && defined(HAVE_ASM_HWCAP_H) && defined(__arm__) && defined(__linux__)
+#if defined(HAVE_SYS_AUXV_H) && defined(HAVE_ASM_HWCAP_H) && (defined(__arm__) || defined(__aarch64__)) && defined(__linux__)
static void
_arm_cpu_features(Eina_Cpu_Features *features)
{
@@ -134,8 +134,15 @@ _arm_cpu_features(Eina_Cpu_Features *features)
aux = getauxval(AT_HWCAP);
- if (aux & HWCAP_NEON)
- *features |= EINA_CPU_NEON;
+# if defined(__aarch64__)
+ *features |= EINA_CPU_NEON;
+# endif
+# ifdef HWCAP_NEON
+ if (aux & HWCAP_NEON) *features |= EINA_CPU_NEON;
+# endif
+# ifdef HWCAP_SVE
+ if (aux & HWCAP_SVE) *features |= EINA_CPU_SVE;
+# endif
}
#endif
@@ -157,7 +164,7 @@ eina_cpu_init(void)
{
#if defined(__i386__) || defined(__x86_64__)
_x86_simd(&eina_cpu_features);
-#elif defined(HAVE_SYS_AUXV_H) && defined(HAVE_ASM_HWCAP_H) && defined(__arm__) && defined(__linux__)
+#elif defined(HAVE_SYS_AUXV_H) && defined(HAVE_ASM_HWCAP_H) && (defined(__arm__) || defined(__aarch64__)) && defined(__linux__)
_arm_cpu_features(&eina_cpu_features);
#endif