summaryrefslogtreecommitdiff
path: root/src/lib/evas/common/evas_cpu.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/evas/common/evas_cpu.c')
-rw-r--r--src/lib/evas/common/evas_cpu.c38
1 files changed, 37 insertions, 1 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