summaryrefslogtreecommitdiff
path: root/src/lib/evas
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/evas
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/evas')
-rw-r--r--src/lib/evas/common/evas_cpu.c38
-rw-r--r--src/lib/evas/include/evas_common_private.h3
2 files changed, 39 insertions, 2 deletions
diff --git a/src/lib/evas/common/evas_cpu.c b/src/lib/evas/common/evas_cpu.c
index 5551775733..d9215e1140 100644
--- a/src/lib/evas/common/evas_cpu.c
+++ b/src/lib/evas/common/evas_cpu.c
@@ -7,7 +7,6 @@
7 7
8static int cpu_feature_mask = 0; 8static int cpu_feature_mask = 0;
9 9
10
11#ifdef BUILD_ALTIVEC 10#ifdef BUILD_ALTIVEC
12# ifdef __POWERPC__ 11# ifdef __POWERPC__
13# ifdef __VEC__ 12# ifdef __VEC__
@@ -26,6 +25,12 @@ static int cpu_feature_mask = 0;
26# endif 25# endif
27#endif 26#endif
28 27
28#if defined(__aarch64__)
29# ifdef BUILD_NEON
30# define NEED_FEATURE_TEST
31# endif
32#endif
33
29#ifdef NEED_FEATURE_TEST 34#ifdef NEED_FEATURE_TEST
30# ifdef HAVE_SIGLONGJMP 35# ifdef HAVE_SIGLONGJMP
31# include <signal.h> 36# include <signal.h>
@@ -70,6 +75,7 @@ evas_common_cpu_neon_test(void)
70# ifdef BUILD_NEON 75# ifdef BUILD_NEON
71# ifdef BUILD_NEON_INTRINSICS 76# ifdef BUILD_NEON_INTRINSICS
72 volatile uint32x4_t temp = vdupq_n_u32(0x1); 77 volatile uint32x4_t temp = vdupq_n_u32(0x1);
78 vaddq_u32(temp, temp);
73# else 79# else
74 asm volatile ( 80 asm volatile (
75 ".fpu neon \n\t" 81 ".fpu neon \n\t"
@@ -85,6 +91,15 @@ evas_common_cpu_neon_test(void)
85} 91}
86 92
87void 93void
94evas_common_cpu_sve_test(void)
95{
96#if defined(__aarch64__)
97 volatile int result = 123;
98 asm("movz %w[res], #10" : [res] "=r" (result));
99#endif
100}
101
102void
88evas_common_cpu_vis_test(void) 103evas_common_cpu_vis_test(void)
89{ 104{
90# ifdef __SPARC__ 105# ifdef __SPARC__
@@ -165,6 +180,10 @@ evas_common_cpu_feature_test(void (*feature)(void))
165 if (feature == evas_common_cpu_neon_test) 180 if (feature == evas_common_cpu_neon_test)
166 return _cpu_check(EINA_CPU_NEON); 181 return _cpu_check(EINA_CPU_NEON);
167# endif 182# endif
183# if defined(__aarch64__)
184 if (feature == evas_common_cpu_sve_test)
185 return _cpu_check(EINA_CPU_SVE);
186# endif
168 return 0; 187 return 0;
169# endif 188# endif
170} 189}
@@ -249,6 +268,23 @@ evas_common_cpu_init(void)
249 else 268 else
250 cpu_feature_mask |= CPU_FEATURE_NEON; 269 cpu_feature_mask |= CPU_FEATURE_NEON;
251#endif 270#endif
271
272#if defined(__aarch64__)
273 if (getenv("EVAS_CPU_NO_SVE"))
274 cpu_feature_mask &= ~CPU_FEATURE_SVE;
275 else
276 {
277# if defined(HAVE_SYS_AUXV_H) && defined(HAVE_ASM_HWCAP_H) && defined(__arm__) && defined(__linux__)
278#error "xx"
279 cpu_feature_mask |= CPU_FEATURE_SVE *
280 !!(eina_cpu_features_get() & EINA_CPU_SVE);
281# else
282 cpu_feature_mask |= CPU_FEATURE_SVE *
283 evas_common_cpu_feature_test(evas_common_cpu_sve_test);
284 evas_common_cpu_end_opt();
285# endif
286 }
287#endif
252} 288}
253 289
254int 290int
diff --git a/src/lib/evas/include/evas_common_private.h b/src/lib/evas/include/evas_common_private.h
index d0354347fc..7fe19b7b9a 100644
--- a/src/lib/evas/include/evas_common_private.h
+++ b/src/lib/evas/include/evas_common_private.h
@@ -503,7 +503,8 @@ typedef enum _CPU_Features
503 CPU_FEATURE_VIS = (1 << 4), 503 CPU_FEATURE_VIS = (1 << 4),
504 CPU_FEATURE_VIS2 = (1 << 5), 504 CPU_FEATURE_VIS2 = (1 << 5),
505 CPU_FEATURE_NEON = (1 << 6), 505 CPU_FEATURE_NEON = (1 << 6),
506 CPU_FEATURE_SSE3 = (1 << 7) 506 CPU_FEATURE_SSE3 = (1 << 7),
507 CPU_FEATURE_SVE = (1 << 8)
507} CPU_Features; 508} CPU_Features;
508 509
509/*****************************************************************************/ 510/*****************************************************************************/