| 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 #include "zutil.h" |
| 12 | 13 |
| 13 int x86_cpu_enable_simd = 0; | 14 int ZLIB_INTERNAL x86_cpu_enable_simd = 0; |
| 14 | 15 |
| 15 #ifndef _MSC_VER | 16 #ifndef _MSC_VER |
| 16 #include <pthread.h> | 17 #include <pthread.h> |
| 17 | 18 |
| 18 pthread_once_t cpu_check_inited_once = PTHREAD_ONCE_INIT; | 19 pthread_once_t cpu_check_inited_once = PTHREAD_ONCE_INIT; |
| 19 static void _x86_check_features(void); | 20 static void _x86_check_features(void); |
| 20 | 21 |
| 21 void x86_check_features(void) | 22 void x86_check_features(void) |
| 22 { | 23 { |
| 23 pthread_once(&cpu_check_inited_once, _x86_check_features); | 24 pthread_once(&cpu_check_inited_once, _x86_check_features); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 x86_cpu_has_sse2 = regs[3] & 0x4000000; | 83 x86_cpu_has_sse2 = regs[3] & 0x4000000; |
| 83 x86_cpu_has_sse42= regs[2] & 0x100000; | 84 x86_cpu_has_sse42= regs[2] & 0x100000; |
| 84 x86_cpu_has_pclmulqdq = regs[2] & 0x2; | 85 x86_cpu_has_pclmulqdq = regs[2] & 0x2; |
| 85 | 86 |
| 86 x86_cpu_enable_simd = x86_cpu_has_sse2 && | 87 x86_cpu_enable_simd = x86_cpu_has_sse2 && |
| 87 x86_cpu_has_sse42 && | 88 x86_cpu_has_sse42 && |
| 88 x86_cpu_has_pclmulqdq; | 89 x86_cpu_has_pclmulqdq; |
| 89 return TRUE; | 90 return TRUE; |
| 90 } | 91 } |
| 91 #endif /* _MSC_VER */ | 92 #endif /* _MSC_VER */ |
| OLD | NEW |