diff options
Diffstat (limited to 'numpy')
| -rw-r--r-- | numpy/distutils/checks/cpu_popcnt.c | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/numpy/distutils/checks/cpu_popcnt.c b/numpy/distutils/checks/cpu_popcnt.c index f6c785dd2..540c98dab 100644 --- a/numpy/distutils/checks/cpu_popcnt.c +++ b/numpy/distutils/checks/cpu_popcnt.c @@ -4,26 +4,16 @@ #include <popcntintrin.h> #endif -#include <stdlib.h> - -int main(void) +int main(int argc, char **argv) { - long long a = 0; - int b; - - a = random(); - b = random(); - -#ifdef _MSC_VER - #ifdef _M_X64 + // To make sure popcnt instructions are generated + // and been tested against the assembler + unsigned long long a = *((unsigned long long*)argv[argc-1]); + unsigned int b = *((unsigned int*)argv[argc-2]); + +#if defined(_M_X64) || defined(__x86_64__) a = _mm_popcnt_u64(a); - #endif - b = _mm_popcnt_u32(b); -#else - #ifdef __x86_64__ - a = __builtin_popcountll(a); - #endif - b = __builtin_popcount(b); #endif + b = _mm_popcnt_u32(b); return (int)a + b; } |
