8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 6d342f3 + 52d5fe1 commit 32b0261Copy full SHA for 32b0261
numpy/distutils/checks/cpu_popcnt.c
@@ -4,20 +4,16 @@
4
#include <popcntintrin.h>
5
#endif
6
7
-int main(void)
+int main(int argc, char **argv)
8
{
9
- long long a = 0;
10
- int b;
11
-#ifdef _MSC_VER
12
- #ifdef _M_X64
13
- a = _mm_popcnt_u64(1);
14
- #endif
15
- b = _mm_popcnt_u32(1);
16
-#else
17
- #ifdef __x86_64__
18
- a = __builtin_popcountll(1);
19
20
- b = __builtin_popcount(1);
+ // 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);
21
+ b = _mm_popcnt_u32(b);
22
return (int)a + b;
23
}
0 commit comments