[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Discuss-gnuradio] Volk: __cpuid_count() for MSVC
From: |
Gisle Vanem |
Subject: |
[Discuss-gnuradio] Volk: __cpuid_count() for MSVC |
Date: |
Mon, 7 Sep 2015 16:31:39 +0200 |
User-agent: |
Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0 SeaMonkey/2.35 |
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:
https://msdn.microsoft.com/en-us/library/vstudio/hskdteyh(v=vs.100).aspx
--
--gv
- [Discuss-gnuradio] Volk: __cpuid_count() for MSVC,
Gisle Vanem <=