discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] Volk: __cpuid_count() for MSVC


From: Tom Rondeau
Subject: Re: [Discuss-gnuradio] Volk: __cpuid_count() for MSVC
Date: Wed, 9 Sep 2015 12:22:02 -0400

On Mon, Sep 7, 2015 at 10:31 AM, Gisle Vanem <address@hidden> wrote:
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

Thanks,  Gisle. Can you post an issue on the VOLK issue tracker?

https://github.com/gnuradio/volk/issues

That's the best place to have these conversations and make sure that it's seen and not lost in email.

Thanks again!

Tom


reply via email to

[Prev in Thread] Current Thread [Next in Thread]