[MPlayer-dev-eng] [PATCH] configure: improve aarch64 handling.
Reimar Döffinger
Reimar.Doeffinger at gmx.de
Thu May 23 22:09:29 EEST 2019
Automatically detect 64- vs. 32-bit build
like for other architectures.
Also detect NEON and VFP support correctly.
Lastly, disable inline assembly NEON code
on AARCH64 that only works on 32-bit.
---
configure | 26 ++++++++++++++++++++++----
libaf/af_format.c | 2 +-
libaf/af_volume.c | 2 +-
libmpcodecs/ad_ffmpeg.c | 2 +-
4 files changed, 25 insertions(+), 7 deletions(-)
diff --git a/configure b/configure
index fc04a568a..af54fe83b 100755
--- a/configure
+++ b/configure
@@ -270,9 +270,16 @@ alpha() {
esac
}
+aarch64() {
+ case "$host_arch" in
+ aarch64*) return 0;;
+ *) return 1;;
+ esac
+}
+
arm() {
case "$host_arch" in
- arm*) return 0;;
+ arm*|aarch64*) return 0;;
*) return 1;;
esac
}
@@ -1895,6 +1902,9 @@ fi
if sparc ; then
cc_check && host_arch=sparc64 || host_arch=sparc
fi
+if arm ; then
+ cc_check && host_arch=aarch64 || host_arch=arm
+fi
fi
echo "Detected operating system: $system_name"
@@ -3223,6 +3233,7 @@ if arm ; then
if test $_armvfp = "auto" ; then
_armvfp=no
inline_asm_check '"fadds s0, s0, s0"' && _armvfp=yes
+ inline_asm_check '"fmadd d0, d0, d1, d2"' && _armvfp=yes
fi
echores "$_armvfp"
@@ -3254,9 +3265,15 @@ if arm ; then
if test $neon = "auto" ; then
neon=no
inline_asm_check '"vadd.i16 q0, q0, q0"' && neon=yes
+ inline_asm_check '"ext v0.8B, v0.8B, v1.8B, #1"' && neon=yes
fi
echores "$neon"
+ echocheck "ARM NEON intrinsics"
+ neon_intrinsics=no
+ statement_check "arm_neon.h" "int16x8_t test = vdupq_n_s16(0)" && neon_intrinsics=yes
+ echores "$neon_intrinsics"
+
echocheck "ARM THUMB"
if test $armthumb = "auto" ; then
armthumb=no
@@ -3265,7 +3282,7 @@ if arm ; then
extra_cflags="$extra_cflags -mthumb"
def_armthumb='#define CONFIG_THUMB 1'
else
- extra_cflags="$extra_cflags -marm"
+ aarch64 || extra_cflags="$extra_cflags -marm"
def_armthumb='#define CONFIG_THUMB 0'
fi
echores "$armthumb"
@@ -3278,7 +3295,7 @@ if arm ; then
echores "$_iwmmxt"
fi
-cpuexts_all='ALTIVEC XOP AVX AVX2 AVX512 FMA3 FMA4 MMX MMX2 MMXEXT AMD3DNOW AMD3DNOWEXT SSE SSE2 SSE3 SSSE3 SSE4 SSE42 FAST_CMOV I686 FAST_CLZ ARMV5TE ARMV6 ARMV6T2 VFP VFPV3 SETEND NEON IWMMXT MMI VIS MVI'
+cpuexts_all='ALTIVEC XOP AVX AVX2 AVX512 FMA3 FMA4 MMX MMX2 MMXEXT AMD3DNOW AMD3DNOWEXT SSE SSE2 SSE3 SSSE3 SSE4 SSE42 FAST_CMOV I686 FAST_CLZ ARMV5TE ARMV6 ARMV6T2 VFP VFPV3 SETEND NEON INTRINSICS_NEON IWMMXT MMI VIS MVI'
test "$_altivec" = yes && cpuexts="ALTIVEC $cpuexts"
test "$_mmx" = yes && cpuexts="MMX $cpuexts"
test "$_mmxext" = yes && cpuexts="MMX2 $cpuexts"
@@ -3307,6 +3324,7 @@ test "$_armvfp" = yes && cpuexts="VFP $cpuexts"
test "$vfpv3" = yes && cpuexts="VFPV3 $cpuexts"
test "$setend" = yes && cpuexts="SETEND $cpuexts"
test "$neon" = yes && cpuexts="NEON $cpuexts"
+test "$neon_intrinsics" = yes && cpuexts="INTRINSICS_NEON $cpuexts"
test "$_iwmmxt" = yes && cpuexts="IWMMXT $cpuexts"
test "$_vis" = yes && cpuexts="VIS $cpuexts"
test "$_mvi" = yes && cpuexts="MVI $cpuexts"
@@ -8987,6 +9005,7 @@ $(ff_config_enable "$cpuexts_all" "$cpuexts" "#" "HAVE")
$(ff_config_enable "$cpuexts_all" "$cpuexts_external" "#" "HAVE" "_EXTERNAL")
$(ff_config_enable "$cpuexts_all" "$cpuexts" "#" "HAVE" "_INLINE")
+#define HAVE_ARMV8 ARCH_AARCH64
/* Blu-ray/DVD/VCD/CD */
#define DEFAULT_CDROM_DEVICE "$default_cdrom_device"
@@ -9340,7 +9359,6 @@ $def_openssl
#define HAVE_INLINE_ASM 1
#define HAVE_INLINE_ASM_NONLOCAL_LABELS 1
#define HAVE_INLINE_ASM_DIRECT_SYMBOL_REFS 1
-#define HAVE_INTRINSICS_NEON 0
#define HAVE_ISATTY 0
#define HAVE_LDBRX 0
#define HAVE_LIBC_MSVCRT 0
diff --git a/libaf/af_format.c b/libaf/af_format.c
index 94109807b..46b6e1d93 100644
--- a/libaf/af_format.c
+++ b/libaf/af_format.c
@@ -494,7 +494,7 @@ static void float2int(const float* in, void* out, int len, int bps)
((int8_t *)out)[i] = av_clip_int8(lrintf(128.0f * in[i]));
break;
case(2):
-#if HAVE_NEON
+#if HAVE_NEON && !ARCH_AARCH64
{
const float *in_end = in + len;
while (in < in_end - 7) {
diff --git a/libaf/af_volume.c b/libaf/af_volume.c
index 0690d58cc..e79aa25f8 100644
--- a/libaf/af_volume.c
+++ b/libaf/af_volume.c
@@ -125,7 +125,7 @@ static av_always_inline void s16_inner_loop(int16_t *data, int len, int offset,
static av_always_inline void float_inner_loop(float *data, int len, int offset, int step, float level, int softclip)
{
int i;
-#if HAVE_NEON
+#if HAVE_NEON && !ARCH_AARCH64
if (offset == 0 && step == 1 && !softclip && len >= 8)
{
__asm__(
diff --git a/libmpcodecs/ad_ffmpeg.c b/libmpcodecs/ad_ffmpeg.c
index ff78a4252..456be5dc9 100644
--- a/libmpcodecs/ad_ffmpeg.c
+++ b/libmpcodecs/ad_ffmpeg.c
@@ -223,7 +223,7 @@ static av_always_inline void copy_samples_planar(size_t bps,
{
size_t s, c, o = 0;
-#if HAVE_NEON_INLINE
+#if HAVE_NEON_INLINE && !ARCH_AARCH64
if (nb_channels == 2 && bps == 4) {
const unsigned char *src0 = src[0];
const unsigned char *src1 = src[1];
--
2.20.1
More information about the MPlayer-dev-eng
mailing list