diff options
author | Derek Foreman <derekf@osg.samsung.com> | 2016-09-16 13:05:56 -0500 |
---|---|---|
committer | Derek Foreman <derekf@osg.samsung.com> | 2016-09-16 13:09:15 -0500 |
commit | 522a8bdef4631aefbf0a83f9e562786f5eddea36 (patch) | |
tree | 938d7da69fbc23b12d78e7d2829f7aa6172c6332 | |
parent | bee8bd53f0f85600124d735272dfe9c83d683f57 (diff) | |
download | efl-devs/derekf/affinity.tar.gz |
eina_cpu: Detect NEON if availabledevs/derekf/affinity
We have a few conditionals around that think this has actually been
set at some point, let's surprise them by actually doing that.
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | src/lib/eina/eina_cpu.c | 21 |
2 files changed, 22 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index 924ceaad39..d0b9962823 100644 --- a/configure.ac +++ b/configure.ac @@ -449,6 +449,8 @@ sys/types.h \ sys/param.h \ sys/mman.h \ netinet/in.h \ +sys/auxv.h \ +asm/hwcap.h \ ]) EFL_CHECK_PATH_MAX diff --git a/src/lib/eina/eina_cpu.c b/src/lib/eina/eina_cpu.c index 539911f35b..661a9e7cd5 100644 --- a/src/lib/eina/eina_cpu.c +++ b/src/lib/eina/eina_cpu.c @@ -53,6 +53,11 @@ #include "eina_cpu_private.h" +#if defined(HAVE_SYS_AUXV_H) && defined(HAVE_ASM_HWCAP_H) && defined(__arm__) && defined(__linux__) +# include <sys/auxv.h> +# include <asm/hwcap.h> +#endif + /*============================================================================* * Local * *============================================================================*/ @@ -130,6 +135,19 @@ void _x86_simd(Eina_Cpu_Features *features) } #endif +#if defined(HAVE_SYS_AUXV_H) && defined(HAVE_ASM_HWCAP_H) && defined(__arm__) && defined(__linux__) +static void +_arm_cpu_features(Eina_Cpu_Features *features) +{ + unsigned long aux; + + aux = getauxval(AT_HWCAP); + + if (aux & HWCAP_NEON) + *features |= EINA_CPU_NEON; +} +#endif + /*============================================================================* * Global * *============================================================================*/ @@ -148,8 +166,9 @@ 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__) + _arm_cpu_features(&eina_cpu_features); #endif - // FIXME: Handle NEON and friends // Figure out the page size for this system _eina_page_size(); |