OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 The LibYuv Project Authors. All rights reserved. | 2 * Copyright 2011 The LibYuv Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 #if (defined(_M_IX86) || defined(_M_X64) || \ | 113 #if (defined(_M_IX86) || defined(_M_X64) || \ |
114 defined(__i386__) || defined(__x86_64__)) && \ | 114 defined(__i386__) || defined(__x86_64__)) && \ |
115 !defined(__pnacl__) && !defined(__CLR_VER) && !defined(__native_client__) | 115 !defined(__pnacl__) && !defined(__CLR_VER) && !defined(__native_client__) |
116 #define HAS_XGETBV | 116 #define HAS_XGETBV |
117 // X86 CPUs have xgetbv to detect OS saves high parts of ymm registers. | 117 // X86 CPUs have xgetbv to detect OS saves high parts of ymm registers. |
118 int GetXCR0() { | 118 int GetXCR0() { |
119 uint32 xcr0 = 0u; | 119 uint32 xcr0 = 0u; |
120 #if (_MSC_FULL_VER >= 160040219) | 120 #if (_MSC_FULL_VER >= 160040219) |
121 xcr0 = (uint32)(_xgetbv(0)); // VS2010 SP1 required. | 121 xcr0 = (uint32)(_xgetbv(0)); // VS2010 SP1 required. |
122 #elif defined(__i386__) || defined(__x86_64__) | 122 #elif defined(__i386__) || defined(__x86_64__) |
123 uint32 xcr0 = 0u; | |
124 asm(".byte 0x0f, 0x01, 0xd0" : "=a" (xcr0) : "c" (0) : "%edx"); | 123 asm(".byte 0x0f, 0x01, 0xd0" : "=a" (xcr0) : "c" (0) : "%edx"); |
125 #endif // defined(__i386__) || defined(__x86_64__) | 124 #endif // defined(__i386__) || defined(__x86_64__) |
126 return xcr0; | 125 return xcr0; |
127 } | 126 } |
128 #endif // defined(_M_IX86) || defined(_M_X64) .. | 127 #endif // defined(_M_IX86) || defined(_M_X64) .. |
129 // Return optimization to previous setting. | 128 // Return optimization to previous setting. |
130 #if defined(_M_IX86) && (_MSC_VER < 1900) | 129 #if defined(_M_IX86) && (_MSC_VER < 1900) |
131 #pragma optimize("g", on) | 130 #pragma optimize("g", on) |
132 #endif | 131 #endif |
133 | 132 |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 // Note that use of this function is not thread safe. | 294 // Note that use of this function is not thread safe. |
296 LIBYUV_API | 295 LIBYUV_API |
297 void MaskCpuFlags(int enable_flags) { | 296 void MaskCpuFlags(int enable_flags) { |
298 cpu_info_ = InitCpuFlags() & enable_flags; | 297 cpu_info_ = InitCpuFlags() & enable_flags; |
299 } | 298 } |
300 | 299 |
301 #ifdef __cplusplus | 300 #ifdef __cplusplus |
302 } // extern "C" | 301 } // extern "C" |
303 } // namespace libyuv | 302 } // namespace libyuv |
304 #endif | 303 #endif |
OLD | NEW |