Bug 880419: disable AVX2 asm if the compiler/assembler don't support it r=glandium

This commit is contained in:
Randell Jesup 2014-01-30 19:55:09 -05:00
Родитель 2574932f6d
Коммит 9986ef60fd
4 изменённых файлов: 25 добавлений и 2 удалений

Просмотреть файл

@ -24,6 +24,7 @@ gyp_vars = {
'build_libvpx': 0,
'build_libyuv': 0,
'libyuv_dir': '/media/libyuv',
'yuv_disable_avx2': 0 if CONFIG['HAVE_X86_AVX2'] else 1,
# saves 4MB when webrtc_trace is off
'enable_lazy_trace_alloc': 1,

Просмотреть файл

@ -1351,6 +1351,20 @@ if test "$GNU_CC"; then
AC_MSG_RESULT([no]))
CFLAGS=$_SAVE_CFLAGS
case "${CPU_ARCH}" in
x86 | x86_64)
AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
AC_TRY_COMPILE([],
[asm volatile ("vpermq \$0xd8,%ymm0,%ymm0 \n");],
result="yes", result="no")
AC_MSG_RESULT("$result")
if test "$result" = "yes"; then
HAVE_X86_AVX2=1
AC_DEFINE(HAVE_X86_AVX2)
AC_SUBST(HAVE_X86_AVX2)
fi
esac
# Turn on GNU-specific warnings:
# -Wall - turn on a lot of warnings
# -Wpointer-arith - good to have

Просмотреть файл

@ -174,8 +174,8 @@ extern "C" {
// The following are available on all x86 platforms, but
// require VS2012, clang 3.4 or gcc 4.7.
// The code supports NaCL but requires a new compiler and validator.
#if !defined(LIBYUV_DISABLE_X86) && (defined(VISUALC_HAS_AVX2) || \
defined(CLANG_HAS_AVX2) || defined(GCC_HAS_AVX2))
#if !defined(LIBYUV_DISABLE_AVX2) && !defined(LIBYUV_DISABLE_X86) && \
(defined(VISUALC_HAS_AVX2) || defined(CLANG_HAS_AVX2) || defined(GCC_HAS_AVX2))
// Effects:
#define HAS_ARGBPOLYNOMIALROW_AVX2
#define HAS_ARGBSHUFFLEROW_AVX2

Просмотреть файл

@ -13,6 +13,7 @@
'variables': {
'use_system_libjpeg%': 0,
'yuv_disable_asm%': 0,
'yuv_disable_avx2%': 0,
'build_neon': 0,
'conditions': [
['target_arch == "arm" and arm_version >= 7 and (arm_neon == 1 or arm_neon_optional == 1)', {
@ -120,6 +121,11 @@
'LIBYUV_DISABLE_MIPS',
],
}],
[ 'yuv_disable_avx2==1', {
'defines': [
'LIBYUV_DISABLE_AVX2',
]
}],
['build_with_mozilla==1', {
'include_dirs': [
'$(DEPTH)/dist/include',
@ -136,6 +142,8 @@
# 'LIBYUV_DISABLE_X86',
# 'LIBYUV_DISABLE_NEON',
# 'LIBYUV_DISABLE_MIPS',
# This disables AVX2 (Haswell) support, overriding compiler checks
# 'LIBYUV_DISABLE_AVX2',
# Enable the following macro to build libyuv as a shared library (dll).
# 'LIBYUV_USING_SHARED_LIBRARY',
],