summaryrefslogtreecommitdiff
path: root/src/lib/eina
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
parente2972420c15737e5709f6c4ee4a30de1fdc4c7e5 (diff)
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')
-rw-r--r--src/lib/eina/eina_cpu.c17
-rw-r--r--src/lib/eina/eina_cpu.h19
2 files changed, 22 insertions, 14 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 @@
49#include "eina_log.h" 49#include "eina_log.h"
50#include "eina_cpu.h" 50#include "eina_cpu.h"
51 51
52#if defined(HAVE_SYS_AUXV_H) && defined(HAVE_ASM_HWCAP_H) && defined(__arm__) && defined(__linux__) 52#if defined(HAVE_SYS_AUXV_H) && defined(HAVE_ASM_HWCAP_H) && (defined(__arm__) || defined(__aarch64__)) && defined(__linux__)
53# include <sys/auxv.h> 53# include <sys/auxv.h>
54# include <asm/hwcap.h> 54# include <asm/hwcap.h>
55#endif 55#endif
@@ -126,7 +126,7 @@ void _x86_simd(Eina_Cpu_Features *features)
126} 126}
127#endif 127#endif
128 128
129#if defined(HAVE_SYS_AUXV_H) && defined(HAVE_ASM_HWCAP_H) && defined(__arm__) && defined(__linux__) 129#if defined(HAVE_SYS_AUXV_H) && defined(HAVE_ASM_HWCAP_H) && (defined(__arm__) || defined(__aarch64__)) && defined(__linux__)
130static void 130static void
131_arm_cpu_features(Eina_Cpu_Features *features) 131_arm_cpu_features(Eina_Cpu_Features *features)
132{ 132{
@@ -134,8 +134,15 @@ _arm_cpu_features(Eina_Cpu_Features *features)
134 134
135 aux = getauxval(AT_HWCAP); 135 aux = getauxval(AT_HWCAP);
136 136
137 if (aux & HWCAP_NEON) 137# if defined(__aarch64__)
138 *features |= EINA_CPU_NEON; 138 *features |= EINA_CPU_NEON;
139# endif
140# ifdef HWCAP_NEON
141 if (aux & HWCAP_NEON) *features |= EINA_CPU_NEON;
142# endif
143# ifdef HWCAP_SVE
144 if (aux & HWCAP_SVE) *features |= EINA_CPU_SVE;
145# endif
139} 146}
140#endif 147#endif
141 148
@@ -157,7 +164,7 @@ eina_cpu_init(void)
157{ 164{
158#if defined(__i386__) || defined(__x86_64__) 165#if defined(__i386__) || defined(__x86_64__)
159 _x86_simd(&eina_cpu_features); 166 _x86_simd(&eina_cpu_features);
160#elif defined(HAVE_SYS_AUXV_H) && defined(HAVE_ASM_HWCAP_H) && defined(__arm__) && defined(__linux__) 167#elif defined(HAVE_SYS_AUXV_H) && defined(HAVE_ASM_HWCAP_H) && (defined(__arm__) || defined(__aarch64__)) && defined(__linux__)
161 _arm_cpu_features(&eina_cpu_features); 168 _arm_cpu_features(&eina_cpu_features);
162#endif 169#endif
163 170
diff --git a/src/lib/eina/eina_cpu.h b/src/lib/eina/eina_cpu.h
index 6235b7b939..6426017be6 100644
--- a/src/lib/eina/eina_cpu.h
+++ b/src/lib/eina/eina_cpu.h
@@ -45,17 +45,18 @@
45 */ 45 */
46typedef enum _Eina_Cpu_Features 46typedef enum _Eina_Cpu_Features
47{ 47{
48 EINA_CPU_MMX = 0x00000001, 48 EINA_CPU_MMX = 0x00000001,
49 EINA_CPU_SSE = 0x00000002, 49 EINA_CPU_SSE = 0x00000002,
50 EINA_CPU_SSE2 = 0x00000004, 50 EINA_CPU_SSE2 = 0x00000004,
51 EINA_CPU_SSE3 = 0x00000008, 51 EINA_CPU_SSE3 = 0x00000008,
52 /* TODO 3DNow! */ 52 /* TODO 3DNow! */
53 EINA_CPU_ALTIVEC = 0x00000010, 53 EINA_CPU_ALTIVEC = 0x00000010,
54 EINA_CPU_VIS = 0x00000020, 54 EINA_CPU_VIS = 0x00000020,
55 EINA_CPU_NEON = 0x00000040, 55 EINA_CPU_NEON = 0x00000040,
56 EINA_CPU_SSSE3 = 0x00000080, 56 EINA_CPU_SSSE3 = 0x00000080,
57 EINA_CPU_SSE41 = 0x00000100, 57 EINA_CPU_SSE41 = 0x00000100,
58 EINA_CPU_SSE42 = 0x00000200 58 EINA_CPU_SSE42 = 0x00000200,
59 EINA_CPU_SVE = 0x00000400
59} Eina_Cpu_Features; 60} Eina_Cpu_Features;
60 61
61/** 62/**