Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.xiph.org/xiph/opus.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxiangmingzhu <xiangzhu@cisco.com>2014-04-30 11:48:07 +0400
committerJean-Marc Valin <jmvalin@jmvalin.ca>2014-10-04 05:16:00 +0400
commitc95c9a048f3283afb2e412b10085d4f7c19e1412 (patch)
treeed8873af6559d7a98922e0fed85be47c826ef521 /configure.ac
parent80460334b77d70e665a390503cd8992cdad06c10 (diff)
Cisco optimization for x86 & fixed point
1. Only for fixed point on x86 platform (32bit and 64bit, uses SIMD intrinsics up to SSE4.2) 2. Use "configure --enable-fixed-point --enable-intrinsics" to enable optimization, default is disabled. 3. Official test cases are verified and passed. Signed-off-by: Timothy B. Terriberry <tterribe@xiph.org>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac109
1 files changed, 109 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index f427f469..9b2f51f4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -189,6 +189,10 @@ AC_ARG_ENABLE([rtcd],
[AS_HELP_STRING([--disable-rtcd], [Disable run-time CPU capabilities detection])],,
[enable_rtcd=yes])
+AC_ARG_ENABLE([intrinsics],
+ [AS_HELP_STRING([--enable-intrinsics], [Enable intrinsics optimizations (only for fixed point x86)])],,
+ [enable_intrinsics=no])
+
rtcd_support=no
cpu_arm=no
@@ -345,6 +349,110 @@ AM_CONDITIONAL([OPUS_ARM_INLINE_ASM],
AM_CONDITIONAL([OPUS_ARM_EXTERNAL_ASM],
[test x"${asm_optimization%% *}" = x"ARM"])
+AM_CONDITIONAL([HAVE_SSE4_1], [false])
+AM_CONDITIONAL([HAVE_SSE2], [false])
+AS_IF([test x"$enable_intrinsics" = x"yes"],[
+AS_IF([test x"$enable_float" = x"no"],
+[AS_IF([test x"$host_cpu" = x"i386" -o x"$host_cpu" = x"i686" -o x"$host_cpu" = x"x86_64"],[
+ AS_IF([test x"$enable_rtcd" = x"yes"],[
+ get_cpuid_by_asm="no"
+ AC_MSG_CHECKING([Get CPU Info])
+ AC_LINK_IFELSE(AC_LANG_PROGRAM([
+ #include <stdio.h>
+ ],[
+ unsigned int CPUInfo0;
+ unsigned int CPUInfo1;
+ unsigned int CPUInfo2;
+ unsigned int CPUInfo3;
+ unsigned int InfoType;
+ __asm__ __volatile__ (
+ "cpuid11":
+ "=a" (CPUInfo0),
+ "=b" (CPUInfo1),
+ "=c" (CPUInfo2),
+ "=d" (CPUInfo3) :
+ "a" (InfoType), "c" (0)
+ );
+ ]),
+ [get_cpuid_by_asm="yes"
+ AC_MSG_RESULT([Inline Assembly])],
+ [AC_LINK_IFELSE(AC_LANG_PROGRAM([
+ #include <cpuid.h>
+ ],[
+ unsigned int CPUInfo0;
+ unsigned int CPUInfo1;
+ unsigned int CPUInfo2;
+ unsigned int CPUInfo3;
+ unsigned int InfoType;
+ __get_cpuid(InfoType, &CPUInfo0, &CPUInfo1, &CPUInfo2, &CPUInfo3);
+ ]),
+ [AC_MSG_RESULT([C method])],
+ [AC_MSG_ERROR([not support Get CPU Info, please disable intrinsics ])])])
+
+ AC_MSG_CHECKING([sse4.1])
+ TMP_CFLAGS="$CFLAGS"
+ gcc -Q --help=target | grep "\-msse4.1 "
+ AS_IF([test x"$?" = x"0"],[
+ CFLAGS="$CFLAGS -msse4.1"
+ AC_CHECK_HEADER(xmmintrin.h, [], [AC_MSG_ERROR([Couldn't find xmmintrin.h])])
+ AC_CHECK_HEADER(emmintrin.h, [], [AC_MSG_ERROR([Couldn't find emmintrin.h])])
+ AC_CHECK_HEADER(smmintrin.h, [], [AC_MSG_ERROR([Couldn't find smmintrin.h])],[
+ #ifdef HAVE_XMMINSTRIN_H
+ #include <xmmintrin.h>
+ #endif
+ #ifdef HAVE_EMMINSTRIN_H
+ #include <emmintrin.h>
+ #endif
+ ])
+
+ AC_LINK_IFELSE(AC_LANG_PROGRAM([
+ #include <xmmintrin.h>
+ #include <emmintrin.h>
+ #include <smmintrin.h>
+ ],[
+ __m128i mtest = _mm_setzero_si128();
+ mtest = _mm_cmpeq_epi64(mtest, mtest);
+ ]),
+ [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([Compiler & linker failure for sse4.1, please disable intrinsics])])
+
+ CFLAGS="$TMP_CFLAGS"
+ AC_DEFINE([OPUS_X86_MAY_HAVE_SSE4_1], [1], [For x86 sse4.1 instrinsics optimizations])
+ AC_DEFINE([OPUS_X86_MAY_HAVE_SSE2], [1], [For x86 sse2 instrinsics optimizations])
+ rtcd_support="x86 sse4.1"
+ AM_CONDITIONAL([HAVE_SSE4_1], [true])
+ AM_CONDITIONAL([HAVE_SSE2], [true])
+ AS_IF([test x"$get_cpuid_by_asm" = x"yes"],[AC_DEFINE([CPU_INFO_BY_ASM], [1], [Get CPU Info by asm method])],
+ [AC_DEFINE([CPU_INFO_BY_C], [1], [Get CPU Info by C method])])
+ ],[
+ gcc -Q --help=target | grep "\-msse2 "
+ AC_MSG_CHECKING([sse2])
+ AS_IF([test x"$?" = x"0"],[
+ AC_MSG_RESULT([yes])
+ CFLAGS="$CFLAGS -msse2"
+ AC_CHECK_HEADER(xmmintrin.h, [], [AC_MSG_ERROR([Couldn't find xmmintrin.h])])
+ AC_CHECK_HEADER(emmintrin.h, [], [AC_MSG_ERROR([Couldn't find emmintrin.h])])
+
+ AC_LINK_IFELSE(AC_LANG_PROGRAM([
+ #include <xmmintrin.h>
+ #include <emmintrin.h>
+ ],[
+ __m128i mtest = _mm_setzero_si128();
+ ]),
+ [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([Compiler & linker failure for sse2, please disable intrinsics])])
+
+ CFLAGS="$TMP_CFLAGS"
+ AC_DEFINE([OPUS_X86_MAY_HAVE_SSE2], [1], [For x86 sse2 instrinsics optimize])
+ rtcd_support="x86 sse2"
+ AM_CONDITIONAL([HAVE_SSE2], [true])
+ AS_IF([test x"$get_cpuid_by_asm" = x"yes"],[AC_DEFINE([CPU_INFO_BY_ASM], [1], [Get CPU Info by asm method])],
+ [AC_DEFINE([CPU_INFO_BY_C], [1], [Get CPU Info by c method])])
+ ],[enable_intrinsics="no"])
+ ])
+ ], [enable_intrinsics="no"])
+])
+], [enable_intrinsics="no"])
+])
+
AS_IF([test x"$enable_rtcd" = x"yes"],[
AS_IF([test x"$rtcd_support" != x"no"],[
AC_DEFINE([OPUS_HAVE_RTCD], [1],
@@ -451,6 +559,7 @@ AC_MSG_NOTICE([
Fixed point debugging: ......... ${enable_fixed_point_debug}
Inline Assembly Optimizations: . ${inline_optimization}
External Assembly Optimizations: ${asm_optimization}
+ Intrinsics Optimizations.......: ${enable_intrinsics}
Run-time CPU detection: ........ ${rtcd_support}
Custom modes: .................. ${enable_custom_modes}
Assertion checking: ............ ${enable_assertions}