summaryrefslogtreecommitdiff
path: root/volk/lib/gcc_x86_cpuid.h
diff options
context:
space:
mode:
Diffstat (limited to 'volk/lib/gcc_x86_cpuid.h')
-rw-r--r--volk/lib/gcc_x86_cpuid.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/volk/lib/gcc_x86_cpuid.h b/volk/lib/gcc_x86_cpuid.h
index 2d0916fb3..95a6722f2 100644
--- a/volk/lib/gcc_x86_cpuid.h
+++ b/volk/lib/gcc_x86_cpuid.h
@@ -176,3 +176,15 @@ __get_cpuid (unsigned int __level,
__cpuid (__level, *__eax, *__ebx, *__ecx, *__edx);
return 1;
}
+
+/* Return Intel AVX extended CPU capabilities register.
+ * This function will bomb on non-AVX-capable machines, so
+ * check for AVX capability before executing.
+ */
+static __inline unsigned int
+xgetbv(void)
+{
+ unsigned int index, __eax, __edx;
+ __asm__ ("xgetbv" : "=a"(__eax), "=d"(__edx) : "c" (index));
+ return __eax;
+}