提交 50bd4801 authored 作者: Steve Underwood's avatar Steve Underwood

Fixed NEON detection and added AVX2 detection to spandsp

上级 dc604fd5
......@@ -135,6 +135,7 @@ AC_ARG_ENABLE(sse4_2, [ --enable-sse4-2 Enable SSE4.2 support])
AC_ARG_ENABLE(sse4a, [ --enable-sse4a Enable SSE4A support])
AC_ARG_ENABLE(sse5, [ --enable-sse5 Enable SSE5 support])
AC_ARG_ENABLE(avx, [ --enable-avx Enable AVX support])
AC_ARG_ENABLE(avx2, [ --enable-avx2 Enable AVX2 support])
AC_ARG_ENABLE(neon, [ --enable-neon Enable NEON support])
AC_ARG_ENABLE(fixed_point, [ --enable-fixed-point Enable fixed point support])
# The following is for MSVC, where we may be using a local copy of libtiff, built alongside spandsp
......@@ -162,6 +163,7 @@ fi
AX_C99_FLEXIBLE_ARRAY
AC_CHECK_FUNCS([aligned_alloc])
AC_CHECK_FUNCS([memmove])
AC_CHECK_FUNCS([memset])
AC_CHECK_FUNCS([select])
......@@ -339,6 +341,9 @@ gnu)
if test "$enable_neon" = "yes" ; then
COMP_VENDOR_CFLAGS="-mfpu=neon $COMP_VENDOR_CFLAGS"
fi
if test "$enable_avx2" = "yes" ; then
COMP_VENDOR_CFLAGS="-mavx2 $COMP_VENDOR_CFLAGS"
fi
if test "$enable_avx" = "yes" ; then
COMP_VENDOR_CFLAGS="-mavx $COMP_VENDOR_CFLAGS"
fi
......@@ -403,6 +408,9 @@ intel)
if test x"$ac_cv_gcc_unused_but_set_variable" = xyes ; then
COMP_VENDOR_CFLAGS="-Wunused-but-set-variable $COMP_VENDOR_CFLAGS"
fi
if test "$enable_avx2" = "yes" ; then
COMP_VENDOR_CFLAGS="-mavx2 $COMP_VENDOR_CFLAGS"
fi
if test "$enable_avx" = "yes" ; then
COMP_VENDOR_CFLAGS="-mavx $COMP_VENDOR_CFLAGS"
fi
......@@ -464,6 +472,10 @@ armv7[bl] | armv7-*)
fi
;;
x86_64-* | i386-* | i686-*)
if test "$enable_avx2" = "yes" ; then
AC_DEFINE([SPANDSP_USE_AVX2], [1], [Use the AVX2 instruction set (i386 and x86_64 only).])
enable_avx="yes"
fi
if test "$enable_avx" = "yes" ; then
AC_DEFINE([SPANDSP_USE_AVX], [1], [Use the AVX instruction set (i386 and x86_64 only).])
enable_sse5="yes"
......@@ -518,6 +530,7 @@ AM_CONDITIONAL([COND_SSE4_2], [test "$enable_sse4_2" = yes])
AM_CONDITIONAL([COND_SSE4A], [test "$enable_sse4a" = yes])
AM_CONDITIONAL([COND_SSE5], [test "$enable_sse5" = yes])
AM_CONDITIONAL([COND_AVX], [test "$enable_avx" = yes])
AM_CONDITIONAL([COND_AVX2], [test "$enable_avx2" = yes])
AM_CONDITIONAL([COND_NEON], [test "$enable_neon" = yes])
if test "$enable_builtin_tiff" = "yes" ; then
......
......@@ -23,19 +23,21 @@ gnu)
CFLAGS="${CFLAGS} -mfpu=neon"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[#include <arm_neon.h>
int32x4_t testfunc(int16_t *a, int16_t *b)
{
return vmull_s16(vld1_s16(a), vld1_s16(b));
}
int main(int argc, char *argv[])
{
[
#include <inttypes.h>
#include <arm_neon.h>
int32x4_t testfunc(int16_t *a, int16_t *b)
{
return vmull_s16(vld1_s16(a), vld1_s16(b));
}
],
[
int32x4_t z;
int16_t x[8];
int16_t y[8];
int16_t x[[8]];
int16_t y[[8]];
z = testfunc(x, y);
}],
[;]
]
)],
[AC_MSG_RESULT([yes])
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论