OLD | NEW |
1 // Copyright 2011 Google Inc. All Rights Reserved. | 1 // Copyright 2011 Google Inc. All Rights Reserved. |
2 // | 2 // |
3 // Use of this source code is governed by a BSD-style license | 3 // Use of this source code is governed by a BSD-style license |
4 // that can be found in the COPYING file in the root of the source | 4 // that can be found in the COPYING file in the root of the source |
5 // tree. An additional intellectual property rights grant can be found | 5 // tree. An additional intellectual property rights grant can be found |
6 // in the file PATENTS. All contributing project authors may | 6 // in the file PATENTS. All contributing project authors may |
7 // be found in the AUTHORS file in the root of the source tree. | 7 // be found in the AUTHORS file in the root of the source tree. |
8 // ----------------------------------------------------------------------------- | 8 // ----------------------------------------------------------------------------- |
9 // | 9 // |
10 // CPU detection | 10 // CPU detection |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 const uint32_t ecx = 0; | 50 const uint32_t ecx = 0; |
51 uint32_t eax, edx; | 51 uint32_t eax, edx; |
52 // Use the raw opcode for xgetbv for compatibility with older toolchains. | 52 // Use the raw opcode for xgetbv for compatibility with older toolchains. |
53 __asm__ volatile ( | 53 __asm__ volatile ( |
54 ".byte 0x0f, 0x01, 0xd0\n" | 54 ".byte 0x0f, 0x01, 0xd0\n" |
55 : "=a"(eax), "=d"(edx) : "c" (ecx)); | 55 : "=a"(eax), "=d"(edx) : "c" (ecx)); |
56 return ((uint64_t)edx << 32) | eax; | 56 return ((uint64_t)edx << 32) | eax; |
57 } | 57 } |
58 #elif defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 160040219 // >= VS2010 SP1 | 58 #elif defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 160040219 // >= VS2010 SP1 |
59 #define xgetbv() _xgetbv(0) | 59 #define xgetbv() _xgetbv(0) |
60 #elif defined(_M_IX86) | 60 #elif defined(_MSC_VER) && defined(_M_IX86) |
61 static WEBP_INLINE uint64_t xgetbv(void) { | 61 static WEBP_INLINE uint64_t xgetbv(void) { |
62 uint32_t eax_, edx_; | 62 uint32_t eax_, edx_; |
63 __asm { | 63 __asm { |
64 xor ecx, ecx // ecx = 0 | 64 xor ecx, ecx // ecx = 0 |
65 // Use the raw opcode for xgetbv for compatibility with older toolchains. | 65 // Use the raw opcode for xgetbv for compatibility with older toolchains. |
66 __asm _emit 0x0f __asm _emit 0x01 __asm _emit 0xd0 | 66 __asm _emit 0x0f __asm _emit 0x01 __asm _emit 0xd0 |
67 mov eax_, eax | 67 mov eax_, eax |
68 mov edx_, edx | 68 mov edx_, edx |
69 } | 69 } |
70 return ((uint64_t)edx_ << 32) | eax_; | 70 return ((uint64_t)edx_ << 32) | eax_; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 #elif defined(WEBP_USE_MIPS32) | 121 #elif defined(WEBP_USE_MIPS32) |
122 static int mipsCPUInfo(CPUFeature feature) { | 122 static int mipsCPUInfo(CPUFeature feature) { |
123 (void)feature; | 123 (void)feature; |
124 return 1; | 124 return 1; |
125 } | 125 } |
126 VP8CPUInfo VP8GetCPUInfo = mipsCPUInfo; | 126 VP8CPUInfo VP8GetCPUInfo = mipsCPUInfo; |
127 #else | 127 #else |
128 VP8CPUInfo VP8GetCPUInfo = NULL; | 128 VP8CPUInfo VP8GetCPUInfo = NULL; |
129 #endif | 129 #endif |
130 | 130 |
OLD | NEW |