Commit daa6f971 authored by jschuh@chromium.org's avatar jschuh@chromium.org

Replace or exclude MMX intrinsics in yuv_convert_simd_x86 due to lack of...

Replace or exclude MMX intrinsics in yuv_convert_simd_x86 due to lack of VS2010 support for them in Win64 

On Win64, exclude MMX version in ChooseFilterYUVRowsProc; still use faster 
SSE2 version. 
Replace _mm_empty() with new yasm that implements EmptyRegisterState_MMX() 
with emms in EmptyRegisterState(), ConvertYUVToRGB32_MMX(...), and 
ConvertYUVToRGB32_SSE(...). 

This patch does not fix other win64 media link errors; more work remains for 
bug 172938. 

Committing for wolenetz from : https://codereview.chromium.org/12082087/#msg15

BUG=172938, 166496
R=wolenetz@chromium.org
TBR=wolenetz@chromium.org
Review URL: https://codereview.chromium.org/12090114

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180141 0039d316-1c4b-4281-b951-d872f2087c98
parent 25ab8f13
...@@ -37,7 +37,7 @@ void ConvertYUVToRGB32_MMX(const uint8* yplane, ...@@ -37,7 +37,7 @@ void ConvertYUVToRGB32_MMX(const uint8* yplane,
width); width);
} }
_mm_empty(); EmptyRegisterState();
} }
void ConvertYUVToRGB32_SSE(const uint8* yplane, void ConvertYUVToRGB32_SSE(const uint8* yplane,
...@@ -64,7 +64,7 @@ void ConvertYUVToRGB32_SSE(const uint8* yplane, ...@@ -64,7 +64,7 @@ void ConvertYUVToRGB32_SSE(const uint8* yplane,
width); width);
} }
_mm_empty(); EmptyRegisterState();
} }
} // namespace media } // namespace media
; Copyright (c) 2013 The Chromium Authors. All rights reserved.
; Use of this source code is governed by a BSD-style license that can be
; found in the LICENSE file.
%include "x86inc.asm"
;
; This file uses MMX instructions as an alternative to _mm_empty() which
; is not supported in Visual Studio 2010 on x64.
; TODO(wolenetz): Use MMX intrinsics when compiling win64 with Visual
; Studio 2012? http://crbug.com/173450
;
SECTION_TEXT
CPU MMX
%define SYMBOL EmptyRegisterState_MMX
global mangle(SYMBOL) PRIVATE
align function_align
mangle(SYMBOL):
emms
ret
...@@ -33,6 +33,21 @@ ...@@ -33,6 +33,21 @@
#endif #endif
#endif #endif
// Visual Studio 2010 does not support MMX intrinsics on x64.
// Some win64 yuv_convert code paths use SSE+MMX yasm, so without rewriting
// them, we use yasm EmptyRegisterState_MMX in place of _mm_empty() or
// hide the versions implemented with heavy use of MMX intrinsics.
// TODO(wolenetz): Use MMX intrinsics when compiling win64 with Visual
// Studio 2012? http://crbug.com/173450
#if !(defined(ARCH_CPU_X86_64) && defined(COMPILER_MSVC))
#define MEDIA_MMX_INTRINSICS_AVAILABLE
#endif
// Assembly functions are declared without namespace.
extern "C" {
void EmptyRegisterState_MMX();
} // extern "C"
namespace media { namespace media {
static FilterYUVRowsProc ChooseFilterYUVRowsProc() { static FilterYUVRowsProc ChooseFilterYUVRowsProc() {
...@@ -40,9 +55,12 @@ static FilterYUVRowsProc ChooseFilterYUVRowsProc() { ...@@ -40,9 +55,12 @@ static FilterYUVRowsProc ChooseFilterYUVRowsProc() {
base::CPU cpu; base::CPU cpu;
if (cpu.has_sse2()) if (cpu.has_sse2())
return &FilterYUVRows_SSE2; return &FilterYUVRows_SSE2;
#if defined(MEDIA_MMX_INTRINSICS_AVAILABLE)
if (cpu.has_mmx()) if (cpu.has_mmx())
return &FilterYUVRows_MMX; return &FilterYUVRows_MMX;
#endif #endif // defined(MEDIA_MMX_INTRINSICS_AVAILABLE)
#endif // defined(ARCH_CPU_X86_FAMILY)
return &FilterYUVRows_C; return &FilterYUVRows_C;
} }
...@@ -97,9 +115,16 @@ void EmptyRegisterState() { ...@@ -97,9 +115,16 @@ void EmptyRegisterState() {
has_mmx = cpu.has_mmx(); has_mmx = cpu.has_mmx();
checked = true; checked = true;
} }
if (has_mmx)
if (has_mmx) {
#if defined(MEDIA_MMX_INTRINSICS_AVAILABLE)
_mm_empty(); _mm_empty();
#endif #else
EmptyRegisterState_MMX();
#endif // defined(MEDIA_MMX_INTRINSICS_AVAILABLE)
}
#endif // defined(ARCH_CPU_X86_FAMILY)
} }
// 16.16 fixed point arithmetic // 16.16 fixed point arithmetic
......
...@@ -121,7 +121,6 @@ void ConvertNV21ToYUV(const uint8* src, ...@@ -121,7 +121,6 @@ void ConvertNV21ToYUV(const uint8* src,
int height); int height);
// Empty SIMD register state after calling optimized scaler functions. // Empty SIMD register state after calling optimized scaler functions.
// This method is only used in unit test after calling SIMD functions.
void EmptyRegisterState(); void EmptyRegisterState();
} // namespace media } // namespace media
......
...@@ -1041,6 +1041,7 @@ ...@@ -1041,6 +1041,7 @@
'base/simd/convert_yuv_to_rgb_mmx.inc', 'base/simd/convert_yuv_to_rgb_mmx.inc',
'base/simd/convert_yuv_to_rgb_sse.asm', 'base/simd/convert_yuv_to_rgb_sse.asm',
'base/simd/convert_yuv_to_rgb_x86.cc', 'base/simd/convert_yuv_to_rgb_x86.cc',
'base/simd/empty_register_state_mmx.asm',
'base/simd/filter_yuv.h', 'base/simd/filter_yuv.h',
'base/simd/filter_yuv_c.cc', 'base/simd/filter_yuv_c.cc',
'base/simd/filter_yuv_mmx.cc', 'base/simd/filter_yuv_mmx.cc',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment