Bug 1284803 part 8 - Disable AVX2 asm if the compiler/assembler don't support it r=jesup
☠☠ backed out by de6927b32ebc ☠ ☠
authorSotaro Ikeda <sotaro.ikeda.g@gmail.com>
Mon, 25 Jul 2016 18:22:30 -0700
changeset 331684 24ebb285aff3e31868ba4f1086950f7b65801190
parent 331683 f7f503edb55b5641cb22d7b9c0f557f620d461e9
child 331685 faf44eac1bb741d25a1b3accf1758a0afb539860
push id9858
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 14:37:10 +0000
treeherdermozilla-aurora@203106ef6cb6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup
bugs1284803
milestone50.0a1
Bug 1284803 part 8 - Disable AVX2 asm if the compiler/assembler don't support it r=jesup
media/libyuv/include/libyuv/row.h
media/libyuv/libyuv.gyp
--- a/media/libyuv/include/libyuv/row.h
+++ b/media/libyuv/include/libyuv/row.h
@@ -189,18 +189,18 @@ extern "C" {
 // https://code.google.com/p/libyuv/issues/detail?id=517
 #define HAS_I422ALPHATOARGBROW_SSSE3
 #endif
 #endif
 
 // 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))
 #define HAS_ARGBCOPYALPHAROW_AVX2
 #define HAS_ARGBCOPYYTOALPHAROW_AVX2
 #define HAS_ARGBMIRRORROW_AVX2
 #define HAS_ARGBPOLYNOMIALROW_AVX2
 #define HAS_ARGBSHUFFLEROW_AVX2
 #define HAS_ARGBTORGB565DITHERROW_AVX2
 #define HAS_ARGBTOUVJROW_AVX2
 #define HAS_ARGBTOUVROW_AVX2
--- a/media/libyuv/libyuv.gyp
+++ b/media/libyuv/libyuv.gyp
@@ -21,16 +21,17 @@
     'libyuv_disable_jpeg%': 0,
     # 'chromium_code' treats libyuv as internal and increases warning level.
     'chromium_code': 1,
     # clang compiler default variable usable by other apps that include libyuv.
     'clang%': 0,
     # Link-Time Optimizations.
     'use_lto%': 0,
     'yuv_disable_asm%': 0,
+    'yuv_disable_avx2%': 0,
     'build_neon': 0,
     'conditions': [
        ['(target_arch == "armv7" or target_arch == "armv7s" or \
        (target_arch == "arm" and arm_version >= 7) or target_arch == "arm64")\
        and (arm_neon == 1 or arm_neon_optional == 1)',
        {
          'build_neon': 1,
        }],
@@ -84,16 +85,21 @@
         [ 'yuv_disable_asm != 0', {
           'defines': [
             # Enable the following 3 macros to turn off assembly for specified CPU.
             'LIBYUV_DISABLE_X86',
             'LIBYUV_DISABLE_NEON',
             'LIBYUV_DISABLE_MIPS',
           ],
         }],
+        [ 'yuv_disable_avx2 == 1', {
+          'defines': [
+            'LIBYUV_DISABLE_AVX2',
+          ]
+        }],
         ['build_with_mozilla == 1', {
           'defines': [
             'HAVE_JPEG'
           ],
           'cflags_mozilla': [
             '$(MOZ_JPEG_CFLAGS)',
           ],
         }],
@@ -122,16 +128,18 @@
           ],
         }],
       ], #conditions
       'defines': [
         # Enable the following 3 macros to turn off assembly for specified CPU.
         # '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',
         # TODO(fbarchard): Make these into gyp defines.
       ],
       'include_dirs': [
         'include',
         '.',
       ],