I noticed since last time (a year ago) I tried building
Volk using MSVC v16, the volk_cpu.tmp.c now uses the
gcc-centric function ‘__cpuid_count()’ which MSVC doesn’t
have.
I’m not really sure if the below patch is correct. But I
assume (from looking at gcc 5.1’s source) that the ECX should
be loaded with the ‘count’ value. So could it be patched into
something like this?
— a/volk/tmpl/volk_cpu.tmpl.c  2015-09-01 13:52:53
+++ b/volk_cpu.tmpl.c     2015-09-07 13:44:25
@@ -71,8 +71,16 @@
static inline unsigned int cpuid_count_x86_bit(unsigned int level,
unsigned int count, unsigned int reg, unsigned int
bit) {
#if defined(VOLK_CPU_x86)
- #if defined(_MSC_VER) && defined(HAVE_INTRIN_H)
- 
int regs[4];
- 
__cpuidex(regs, level, count);
- 
#elif defined(GNUC)
 unsigned int regs[4];
 __cpuid_count(level, count, regs[0], regs[1], regs[2], regs[3]);
- #else
- 
#error No __cpuid()!
- 
#endif
 return regs[reg] >> bit & 0x01;
 #else
 return 0;
Just to let you know.
The docs on MSVC’s __cpuidex() is here:
__cpuid, __cpuidex | Microsoft Learn
–
–gv