aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/avx-os-support.h
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.target/i386/avx-os-support.h')
-rw-r--r--gcc/testsuite/gcc.target/i386/avx-os-support.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/i386/avx-os-support.h b/gcc/testsuite/gcc.target/i386/avx-os-support.h
new file mode 100644
index 00000000000..21d332f7d3d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx-os-support.h
@@ -0,0 +1,10 @@
+/* Check if the OS supports executing AVX instructions. */
+
+static int
+avx_os_support (void)
+{
+ unsigned int eax, edx;
+
+ __asm__ ("xgetbv" : "=a" (eax), "=d" (edx) : "c" (0));
+ return (eax & 6) == 6;
+}