From 529558453f6d1f5b828cf79dc9c6020f6bd7164d Mon Sep 17 00:00:00 2001 From: "fbarchard@google.com" Date: Tue, 24 Sep 2013 01:13:43 +0000 Subject: [PATCH] Add gcc 4.7 support for AVX2 BUG=269 TEST=g++ -c source/row_posix.cc -I include/ R=nfullagar@google.com Review URL: https://webrtc-codereview.appspot.com/2273006 git-svn-id: http://libyuv.googlecode.com/svn/trunk@797 16f28f9a-4ce2-e073-06de-1de4eb20be90 --- README.chromium | 2 +- include/libyuv/row.h | 10 ++++++++-- include/libyuv/version.h | 2 +- source/row_posix.cc | 3 ++- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/README.chromium b/README.chromium index 796777e30..bb1a54b9e 100644 --- a/README.chromium +++ b/README.chromium @@ -1,6 +1,6 @@ Name: libyuv URL: http://code.google.com/p/libyuv/ -Version: 796 +Version: 797 License: BSD License File: LICENSE diff --git a/include/libyuv/row.h b/include/libyuv/row.h index 4e3943b40..870892ed5 100644 --- a/include/libyuv/row.h +++ b/include/libyuv/row.h @@ -142,11 +142,17 @@ extern "C" { #endif // The following are available on all x86 platforms, including NaCL, but -// require VS2012, llvm or NaCL. +// require VS2012, clang, gcc4.7 or NaCL. // Caveat: llvm 3.1 required, but does not provide a version. +#if defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__)) +/* Test for GCC >= 4.7.0 */ +#if (__GNUC__ > 4) || (__GNUC__ == 4 && (__GNUC_MINOR__ >= 7)) +#define GCC_HAS_AVX2 1 +#endif // GNUC >= 4.7 +#endif // __GNUC__ #if !defined(LIBYUV_DISABLE_X86) && \ ((defined(_M_IX86) && defined(_MSC_VER) && _MSC_VER >= 1700) || \ - defined(__native_client__) || defined(__clang__)) + defined(__native_client__) || defined(__clang__) || defined(GCC_HAS_AVX2)) // Effects: #define HAS_ARGBPOLYNOMIALROW_AVX2 #endif diff --git a/include/libyuv/version.h b/include/libyuv/version.h index 7597a0d63..232d18f23 100644 --- a/include/libyuv/version.h +++ b/include/libyuv/version.h @@ -11,6 +11,6 @@ #ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT #define INCLUDE_LIBYUV_VERSION_H_ -#define LIBYUV_VERSION 796 +#define LIBYUV_VERSION 797 #endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT diff --git a/source/row_posix.cc b/source/row_posix.cc index 2438d1bb8..e3fa64a96 100644 --- a/source/row_posix.cc +++ b/source/row_posix.cc @@ -5915,7 +5915,8 @@ void ARGBPolynomialRow_AVX2(const uint8* src_argb, : "r"(poly) // %3 : "memory", "cc" #if defined(__SSE2__) - , "ymm0", "ymm1", "ymm2", "ymm3", "ymm4", "ymm5", "ymm6", "ymm7" +// TODO(fbarchard): declare ymm usage when applicable. + , "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7" #endif ); }