diff options
author | Johnathan Corgan | 2012-04-19 09:21:09 -0700 |
---|---|---|
committer | Johnathan Corgan | 2012-04-19 09:21:09 -0700 |
commit | 9f879534f21301b24fc5fdee54966d937f37f927 (patch) | |
tree | 2e3a6601af29e73b61e2e54332b6d12e4c9e16f7 /volk/gen/make_cpuid_c.py | |
parent | c954791fe78c2ab669cca9bbc4817a278910e1e1 (diff) | |
parent | ef97a9935853b928cefe0bf27273e935c0df7552 (diff) | |
download | gnuradio-9f879534f21301b24fc5fdee54966d937f37f927.tar.gz gnuradio-9f879534f21301b24fc5fdee54966d937f37f927.tar.bz2 gnuradio-9f879534f21301b24fc5fdee54966d937f37f927.zip |
Merge branch 'maint'
Diffstat (limited to 'volk/gen/make_cpuid_c.py')
-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 a8939fb90..005fc2b19 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 __GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 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 |