OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebM 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 #define HAS_SSE2 0x04 | 109 #define HAS_SSE2 0x04 |
110 #define HAS_SSE3 0x08 | 110 #define HAS_SSE3 0x08 |
111 #define HAS_SSSE3 0x10 | 111 #define HAS_SSSE3 0x10 |
112 #define HAS_SSE4_1 0x20 | 112 #define HAS_SSE4_1 0x20 |
113 #define HAS_AVX 0x40 | 113 #define HAS_AVX 0x40 |
114 #define HAS_AVX2 0x80 | 114 #define HAS_AVX2 0x80 |
115 #ifndef BIT | 115 #ifndef BIT |
116 #define BIT(n) (1<<n) | 116 #define BIT(n) (1<<n) |
117 #endif | 117 #endif |
118 | 118 |
119 static int | 119 static INLINE int |
120 x86_simd_caps(void) { | 120 x86_simd_caps(void) { |
121 unsigned int flags = 0; | 121 unsigned int flags = 0; |
122 unsigned int mask = ~0; | 122 unsigned int mask = ~0; |
123 unsigned int reg_eax, reg_ebx, reg_ecx, reg_edx; | 123 unsigned int reg_eax, reg_ebx, reg_ecx, reg_edx; |
124 char *env; | 124 char *env; |
125 (void)reg_ebx; | 125 (void)reg_ebx; |
126 | 126 |
127 /* See if the CPU capabilities are being overridden by the environment */ | 127 /* See if the CPU capabilities are being overridden by the environment */ |
128 env = getenv("VPX_SIMD_CAPS"); | 128 env = getenv("VPX_SIMD_CAPS"); |
129 | 129 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 165 |
166 if (reg_ebx & BIT(5)) flags |= HAS_AVX2; | 166 if (reg_ebx & BIT(5)) flags |= HAS_AVX2; |
167 | 167 |
168 return flags & mask; | 168 return flags & mask; |
169 } | 169 } |
170 | 170 |
171 #if ARCH_X86_64 && defined(_MSC_VER) | 171 #if ARCH_X86_64 && defined(_MSC_VER) |
172 unsigned __int64 __rdtsc(void); | 172 unsigned __int64 __rdtsc(void); |
173 #pragma intrinsic(__rdtsc) | 173 #pragma intrinsic(__rdtsc) |
174 #endif | 174 #endif |
175 static unsigned int | 175 static INLINE unsigned int |
176 x86_readtsc(void) { | 176 x86_readtsc(void) { |
177 #if defined(__GNUC__) && __GNUC__ | 177 #if defined(__GNUC__) && __GNUC__ |
178 unsigned int tsc; | 178 unsigned int tsc; |
179 __asm__ __volatile__("rdtsc\n\t":"=a"(tsc):); | 179 __asm__ __volatile__("rdtsc\n\t":"=a"(tsc):); |
180 return tsc; | 180 return tsc; |
181 #elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) | 181 #elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) |
182 unsigned int tsc; | 182 unsigned int tsc; |
183 asm volatile("rdtsc\n\t":"=a"(tsc):); | 183 asm volatile("rdtsc\n\t":"=a"(tsc):); |
184 return tsc; | 184 return tsc; |
185 #else | 185 #else |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 __asm { fldcw mode } | 242 __asm { fldcw mode } |
243 } | 243 } |
244 static unsigned short | 244 static unsigned short |
245 x87_get_control_word(void) { | 245 x87_get_control_word(void) { |
246 unsigned short mode; | 246 unsigned short mode; |
247 __asm { fstcw mode } | 247 __asm { fstcw mode } |
248 return mode; | 248 return mode; |
249 } | 249 } |
250 #endif | 250 #endif |
251 | 251 |
252 static unsigned short | 252 static INLINE unsigned int |
253 x87_set_double_precision(void) { | 253 x87_set_double_precision(void) { |
254 unsigned short mode = x87_get_control_word(); | 254 unsigned int mode = x87_get_control_word(); |
255 x87_set_control_word((mode&~0x300) | 0x200); | 255 x87_set_control_word((mode&~0x300) | 0x200); |
256 return mode; | 256 return mode; |
257 } | 257 } |
258 | 258 |
259 | 259 |
260 extern void vpx_reset_mmx_state(void); | 260 extern void vpx_reset_mmx_state(void); |
261 | 261 |
262 #ifdef __cplusplus | 262 #ifdef __cplusplus |
263 } // extern "C" | 263 } // extern "C" |
264 #endif | 264 #endif |
265 | 265 |
266 #endif // VPX_PORTS_X86_H_ | 266 #endif // VPX_PORTS_X86_H_ |
OLD | NEW |