]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Fixed NEON detection and added AVX2 detection to spandsp
authorSteve Underwood <steveu@coppice.org>
Thu, 20 Jun 2013 15:53:53 +0000 (23:53 +0800)
committerSteve Underwood <steveu@coppice.org>
Thu, 20 Jun 2013 15:53:53 +0000 (23:53 +0800)
libs/spandsp/configure.ac
libs/spandsp/m4/ax_check_arm_neon.m4

index bfdf80381e9e985708f9860501a141f6ad890b14..dacc3ae4edaa9d678cc5b74f31f28311b8e5c70d 100644 (file)
@@ -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
index 80e0fc0605744f2fc3486c43cb4d260be8b0da58..1e972686ef44d141599eacde0938c0a1077ef6fb 100644 (file)
@@ -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])