Commit 15df877b authored by fbarchard@google.com's avatar fbarchard@google.com

Use emit for xgetbv for compatibility with vs2005, vs2008 and vs2010 without sp1.

BUG=none
TEST=none
R=nfullagar@google.com, tpsiaki@google.com

Review URL: https://webrtc-codereview.appspot.com/3089005

git-svn-id: http://libyuv.googlecode.com/svn/trunk@833 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent 21796c94
Name: libyuv
URL: http://code.google.com/p/libyuv/
Version: 832
Version: 833
License: BSD
License File: LICENSE
......
......@@ -72,6 +72,7 @@ int YUY2ToI422(const uint8* src_yuy2, int src_stride_yuy2,
int width, int height);
// Convert UYVY to I422.
LIBYUV_API
int UYVYToI422(const uint8* src_uyvy, int src_stride_uyvy,
uint8* dst_y, int dst_stride_y,
uint8* dst_u, int dst_stride_u,
......
......@@ -11,6 +11,6 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
#define INCLUDE_LIBYUV_VERSION_H_
#define LIBYUV_VERSION 832
#define LIBYUV_VERSION 833
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
......@@ -60,15 +60,22 @@ void CpuId(uint32 eax, uint32 ecx, uint32* cpu_info) {
cpu_info[3] = edx;
#endif // defined(_MSC_VER)
}
#if !defined(__native_client__)
#define HAS_XGETBV
// X86 CPUs have xgetbv to detect OS saves high parts of ymm registers.
int TestOsSaveYmm() {
uint32 xcr0;
#if defined(_MSC_VER)
uint32 xcr0 = 0u;
#if defined(_MSC_VER) && (_MSC_FULL_VER >= 160040219)
xcr0 = static_cast<uint32>(_xgetbv(0)); // VS2010 SP1 required.
#else
asm volatile ("xgetbv" : "=a" (xcr0) : "c" (0) : "%edx" ); // NOLINT
#elif defined(_M_IX86)
__asm {
xor ecx, ecx // xcr 0
_asm _emit 0x0f _asm _emit 0x01 _asm _emit 0xd0 // For VS2010 and earlier.
mov xcr0, eax
}
#elif defined(__i386__) || defined(__x86_64__)
asm volatile (".byte 0x0f, 0x01, 0xd0" : "=a" (xcr0) : "c" (0) : "%edx" );
#endif // defined(_MSC_VER)
return((xcr0 & 6) == 6); // Is ymm saved?
}
......
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