diff options
author | Josh Blum | 2012-04-18 11:18:21 -0700 |
---|---|---|
committer | Josh Blum | 2012-04-18 11:18:21 -0700 |
commit | ad9752793bbb7134e14483553766ab3d36e02366 (patch) | |
tree | 0fd21ce62a151e78c7dc30d808430ac220d9d898 /volk/gen | |
parent | 0765dc05054e74d177d715697e3d5c89886cd838 (diff) | |
download | gnuradio-ad9752793bbb7134e14483553766ab3d36e02366.tar.gz gnuradio-ad9752793bbb7134e14483553766ab3d36e02366.tar.bz2 gnuradio-ad9752793bbb7134e14483553766ab3d36e02366.zip |
volk: added xgetbv stuff from volk_work to maint
This ensures that the compiler has support for xgetbv.
This also fixes MSVC by checking for _xgetbv.
Also, restored copy of cpuid.h, this should not be modified.
Diffstat (limited to 'volk/gen')
-rw-r--r-- | volk/gen/make_cpuid_c.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/volk/gen/make_cpuid_c.py b/volk/gen/make_cpuid_c.py index c6bb5059e..674b4fb2e 100644 --- a/volk/gen/make_cpuid_c.py +++ b/volk/gen/make_cpuid_c.py @@ -41,11 +41,32 @@ struct VOLK_CPU volk_cpu; #include <gcc_x86_cpuid.h> #define cpuid_x86(op, r) __get_cpuid(op, (unsigned int *)r+0, (unsigned int *)r+1, (unsigned int *)r+2, (unsigned int *)r+3) + /* Return Intel AVX extended CPU capabilities register. + * This function will bomb on non-AVX-capable machines, so + * check for AVX capability before executing. + */ + #if defined(__GNUC_PREREQ) && __GNUC_PREREQ(4, 4) + static inline unsigned long long _xgetbv(unsigned int index){ + unsigned int eax, edx; + __asm__ __volatile__("xgetbv" : "=a"(eax), "=d"(edx) : "c"(index)); + return ((unsigned long long)edx << 32) | eax; + } + #define __xgetbv() _xgetbv(0) + #else + #define __xgetbv() 0 + #endif + //implement get cpuid for MSVC compilers using __cpuid intrinsic #elif defined(_MSC_VER) #include <intrin.h> #define cpuid_x86(op, r) __cpuid(r, op) + #if defined(_XCR_XFEATURE_ENABLED_MASK) + #define __xgetbv() _xgetbv(_XCR_XFEATURE_ENABLED_MASK) + #else + #define __xgetbv() 0 + #endif + #else #error "A get cpuid for volk is not available on this compiler..." #endif |