Bug 1341543: Update SIMD_ALIGNED in gfx to match libyuv's definition r=sotaro
authorRandell Jesup <rjesup@jesup.org>
Fri, 24 Feb 2017 14:01:56 -0500
changeset 373835 558258e4712afe8272ea73a705876cd34a6c48f7
parent 373834 c560b9eed8b12f88686453cbb8bf52c93a31636b
child 373836 b21f4e412b6667a67d257cf52618c848ad06d8de
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssotaro
bugs1341543
milestone54.0a1
Bug 1341543: Update SIMD_ALIGNED in gfx to match libyuv's definition r=sotaro MozReview-Commit-ID: 35D3W0Dqrc8
gfx/ycbcr/yuv_row.h
--- a/gfx/ycbcr/yuv_row.h
+++ b/gfx/ycbcr/yuv_row.h
@@ -111,21 +111,33 @@ void LinearScaleYUVToRGB32Row(const uint
 void LinearScaleYUVToRGB32Row_C(const uint8* y_buf,
                                 const uint8* u_buf,
                                 const uint8* v_buf,
                                 uint8* rgb_buf,
                                 int width,
                                 int source_dx);
 
 
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) && !defined(__CLR_VER) && !defined(__clang__)
+#if defined(VISUALC_HAS_AVX2)
+#define SIMD_ALIGNED(var) __declspec(align(32)) var
+#else
 #define SIMD_ALIGNED(var) __declspec(align(16)) var
+#endif
+#elif defined(__GNUC__) || defined(__clang__)
+// Caveat GCC 4.2 to 4.7 have a known issue using vectors with const.
+#if defined(CLANG_HAS_AVX2) || defined(GCC_HAS_AVX2)
+#define SIMD_ALIGNED(var) var __attribute__((aligned(32)))
 #else
 #define SIMD_ALIGNED(var) var __attribute__((aligned(16)))
 #endif
+#else
+#define SIMD_ALIGNED(var) var
+#endif
+
 extern SIMD_ALIGNED(const int16 kCoefficientsRgbY[768][4]);
 
 // x64 uses MMX2 (SSE) so emms is not required.
 // Warning C4799: function has no EMMS instruction.
 // EMMS() is slow and should be called by the calling function once per image.
 #if defined(ARCH_CPU_X86) && !defined(ARCH_CPU_X86_64)
 #if defined(_MSC_VER)
 #define EMMS() __asm emms