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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 } | 209 } |
210 cpu_info_ = ((cpu_info1[3] & 0x04000000) ? kCpuHasSSE2 : 0) | | 210 cpu_info_ = ((cpu_info1[3] & 0x04000000) ? kCpuHasSSE2 : 0) | |
211 ((cpu_info1[2] & 0x00000200) ? kCpuHasSSSE3 : 0) | | 211 ((cpu_info1[2] & 0x00000200) ? kCpuHasSSSE3 : 0) | |
212 ((cpu_info1[2] & 0x00080000) ? kCpuHasSSE41 : 0) | | 212 ((cpu_info1[2] & 0x00080000) ? kCpuHasSSE41 : 0) | |
213 ((cpu_info1[2] & 0x00100000) ? kCpuHasSSE42 : 0) | | 213 ((cpu_info1[2] & 0x00100000) ? kCpuHasSSE42 : 0) | |
214 ((cpu_info7[1] & 0x00000200) ? kCpuHasERMS : 0) | | 214 ((cpu_info7[1] & 0x00000200) ? kCpuHasERMS : 0) | |
215 ((cpu_info1[2] & 0x00001000) ? kCpuHasFMA3 : 0) | | 215 ((cpu_info1[2] & 0x00001000) ? kCpuHasFMA3 : 0) | |
216 kCpuHasX86; | 216 kCpuHasX86; |
217 | 217 |
218 #ifdef HAS_XGETBV | 218 #ifdef HAS_XGETBV |
219 // Avoid call to xgetbv if AVX disabled for drmemory. | 219 // AVX requires CPU has AVX, XSAVE and OSXSave for xgetbv |
220 // TODO(fbarchard): check xsave before calling xgetbv. | 220 if ((cpu_info1[2] & 0x1c000000) == 0x1c000000 && // AVX and OSXSave |
221 if ((cpu_info1[2] & 0x18000000) == 0x18000000 && // AVX and OSSave | |
222 !TestEnv("LIBYUV_DISABLE_AVX") && TestOsSaveYmm()) { // Saves YMM. | 221 !TestEnv("LIBYUV_DISABLE_AVX") && TestOsSaveYmm()) { // Saves YMM. |
223 cpu_info_ |= ((cpu_info7[1] & 0x00000020) ? kCpuHasAVX2 : 0) | | 222 cpu_info_ |= ((cpu_info7[1] & 0x00000020) ? kCpuHasAVX2 : 0) | |
224 kCpuHasAVX; | 223 kCpuHasAVX; |
225 } | 224 } |
226 #endif | 225 #endif |
227 // Environment variable overrides for testing. | 226 // Environment variable overrides for testing. |
228 if (TestEnv("LIBYUV_DISABLE_X86")) { | 227 if (TestEnv("LIBYUV_DISABLE_X86")) { |
229 cpu_info_ &= ~kCpuHasX86; | 228 cpu_info_ &= ~kCpuHasX86; |
230 } | 229 } |
231 if (TestEnv("LIBYUV_DISABLE_SSE2")) { | 230 if (TestEnv("LIBYUV_DISABLE_SSE2")) { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 | 296 |
298 LIBYUV_API | 297 LIBYUV_API |
299 void MaskCpuFlags(int enable_flags) { | 298 void MaskCpuFlags(int enable_flags) { |
300 cpu_info_ = InitCpuFlags() & enable_flags; | 299 cpu_info_ = InitCpuFlags() & enable_flags; |
301 } | 300 } |
302 | 301 |
303 #ifdef __cplusplus | 302 #ifdef __cplusplus |
304 } // extern "C" | 303 } // extern "C" |
305 } // namespace libyuv | 304 } // namespace libyuv |
306 #endif | 305 #endif |
OLD | NEW |