[vlc-commits] cpu: generic support for ARM SVE

Rémi Denis-Courmont git at videolan.org
Tue Dec 11 21:57:22 CET 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Dec 11 19:51:58 2018 +0200| [edf6ff75449afff38cfe2cdd614cba1116551f42] | committer: Rémi Denis-Courmont

cpu: generic support for ARM SVE

This adds generic support for the AArch64 Scalable Vector Extension.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=edf6ff75449afff38cfe2cdd614cba1116551f42
---

 configure.ac      | 23 +++++++++++++++++++++++
 include/vlc_cpu.h |  8 ++++++++
 2 files changed, 31 insertions(+)

diff --git a/configure.ac b/configure.ac
index d34c2e60c8..cd71a4e5be 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1506,6 +1506,29 @@ asm volatile("uhadd v0.8b, v0.8b, v1.8b":::"v0");
 ])
 AM_CONDITIONAL([HAVE_ARM64], [test "${ac_cv_arm64}" = "yes"])
 
+AC_ARG_ENABLE([sve],
+  AS_HELP_STRING([--disable-sve],
+    [disable ARM SVE optimizations (default auto)]),, [
+  AS_IF([test "${host_cpu}" = "aarch64"], [enable_sve="yes"] ,[enable_sve="no"])
+])
+AS_IF([test "${enable_sve}" != "no"], [
+  VLC_SAVE_FLAGS
+  CFLAGS="${CFLAGS} -march=armv8-a+sve"
+  AC_CACHE_CHECK([if $CCAS groks ARM SVE assembly], [ac_cv_arm_sve], [
+    AC_COMPILE_IFELSE([
+      AC_LANG_PROGRAM(,[[
+asm volatile("ptrue p0.s" ::: "p0");
+]])
+    ], [
+      ac_cv_arm_sve="yes"
+    ], [
+      ac_cv_arm_sve="no"
+    ])
+  ])
+  VLC_RESTORE_FLAGS
+])
+AM_CONDITIONAL([HAVE_SVE], [test "${ac_cv_arm_sve}" = "yes"])
+
 
 AC_ARG_ENABLE([altivec],
   AS_HELP_STRING([--disable-altivec],
diff --git a/include/vlc_cpu.h b/include/vlc_cpu.h
index b2f0f4564e..b95f851fff 100644
--- a/include/vlc_cpu.h
+++ b/include/vlc_cpu.h
@@ -170,9 +170,17 @@ VLC_API unsigned vlc_CPU(void);
 
 # elif defined (__aarch64__)
 #  define HAVE_FPU 1
+#  define VLC_CPU_ARM_SVE 0x1
+
 // NEON is mandatory for general purpose ARMv8-a CPUs
 #  define vlc_CPU_ARM64_NEON() (1)
 
+#  ifdef __ARM_FEATURE_SVE
+#   define vlc_CPU_ARM_SVE()   (1)
+#  else
+#   define vlc_CPU_ARM_SVE()   ((vlc_CPU() & VLC_CPU_ARM_SVE) != 0)
+#  endif
+
 # elif defined (__sparc__)
 #  define HAVE_FPU 1
 



More information about the vlc-commits mailing list