From: Petri H. <phi...@us...> - 2012-07-16 19:41:46
|
# HG changeset patch # User Petri Hintukainen <phi...@us...> # Date 1342467601 -10800 # Node ID 07eba8d2d5f4d92decd614190f5bcfbef6fe3fd5 # Branch default # Parent 3c6ac1ecded740ace7ef80f75eeddbfceb3cb3c1 Added configure check for AVX assembler support diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -448,6 +448,13 @@ [AC_DEFINE([ASMALIGN_1SLN], [1], [define if '.align n' means alignment to (1 << n) - byte boundaries])]) +dnl avx instruction set support +AC_MSG_CHECKING([for AVX assembler]) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[asm("vmovaps %ymm1, %ymm0");]])], + [AC_DEFINE([HAVE_AVX], [1], + [define if compiler supports avx inline assembler]) + AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)]) + CC_ATTRIBUTE_ALIGNED CC_ATTRIBUTE_VISIBILITY([protected], --git a/src/xine-utils/memcpy.c b/src/xine-utils/memcpy.c --- a/src/xine-utils/memcpy.c +++ b/src/xine-utils/memcpy.c @@ -259,6 +259,7 @@ return retval; } +#ifdef HAVE_AVX static void * avx_memcpy(void * to, const void * from, size_t len) { void *retval; @@ -348,6 +349,7 @@ if(len) linux_kernel_memcpy_impl(to, from, len); return retval; } +#endif /* HAVE_AVX */ static void * mmx_memcpy(void * to, const void * from, size_t len) { @@ -490,7 +492,9 @@ { "MMX ", mmx_memcpy, MM_MMX }, { "MMXEXT", mmx2_memcpy, MM_MMXEXT }, { "SSE", sse_memcpy, MM_MMXEXT|MM_SSE }, +# ifdef HAVE_AVX { "AVX", avx_memcpy, MM_ACCEL_X86_AVX }, +# endif /* HAVE_AVX */ #endif /* ARCH_X86 */ #if defined (ARCH_PPC) && !defined (HOST_OS_DARWIN) { "ppcasm", ppcasm_memcpy, 0 }, @@ -570,7 +574,10 @@ static const char *const memcpy_methods[] = { "probe", "libc", #if (defined(ARCH_X86) || defined(ARCH_X86_64)) && !defined(_MSC_VER) - "kernel", "mmx", "mmxext", "sse", "avx", + "kernel", "mmx", "mmxext", "sse", +# ifdef HAVE_AVX + "avx", +# endif /* HAVE_AVX */ #endif #if defined (ARCH_PPC) && !defined (HOST_OS_DARWIN) "ppcasm_memcpy", "ppcasm_cacheable_memcpy", |