OLD | NEW |
1 /* | 1 /* |
2 * x86 feature check | 2 * x86 feature check |
3 * | 3 * |
4 * Copyright (C) 2013 Intel Corporation. All rights reserved. | 4 * Copyright (C) 2013 Intel Corporation. All rights reserved. |
5 * Author: | 5 * Author: |
6 * Jim Kukunas | 6 * Jim Kukunas |
7 * | 7 * |
8 * For conditions of distribution and use, see copyright notice in zlib.h | 8 * For conditions of distribution and use, see copyright notice in zlib.h |
9 */ | 9 */ |
10 | 10 |
11 #include "x86.h" | 11 #include "x86.h" |
12 | 12 |
13 int x86_cpu_enable_simd; | 13 int x86_cpu_enable_simd = 0; |
14 | 14 |
15 #ifndef _MSC_VER | 15 #ifndef _MSC_VER |
16 #include <pthread.h> | 16 #include <pthread.h> |
17 | 17 |
18 pthread_once_t cpu_check_inited_once = PTHREAD_ONCE_INIT; | 18 pthread_once_t cpu_check_inited_once = PTHREAD_ONCE_INIT; |
19 static void _x86_check_features(void); | 19 static void _x86_check_features(void); |
20 | 20 |
21 void x86_check_features(void) | 21 void x86_check_features(void) |
22 { | 22 { |
23 pthread_once(&cpu_check_inited_once, _x86_check_features); | 23 pthread_once(&cpu_check_inited_once, _x86_check_features); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 103 |
104 x86_cpu_has_sse2 = regs[3] & 0x4000000; | 104 x86_cpu_has_sse2 = regs[3] & 0x4000000; |
105 x86_cpu_has_sse42= regs[2] & 0x100000; | 105 x86_cpu_has_sse42= regs[2] & 0x100000; |
106 x86_cpu_has_pclmulqdq = regs[2] & 0x2; | 106 x86_cpu_has_pclmulqdq = regs[2] & 0x2; |
107 | 107 |
108 x86_cpu_enable_simd = x86_cpu_has_sse2 && | 108 x86_cpu_enable_simd = x86_cpu_has_sse2 && |
109 x86_cpu_has_sse42 && | 109 x86_cpu_has_sse42 && |
110 x86_cpu_has_pclmulqdq; | 110 x86_cpu_has_pclmulqdq; |
111 } | 111 } |
112 #endif /* _MSC_VER */ | 112 #endif /* _MSC_VER */ |
OLD | NEW |