aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/i386/fma-check.h
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.target/i386/fma-check.h')
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/i386/fma-check.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/i386/fma-check.h b/gcc-4.9/gcc/testsuite/gcc.target/i386/fma-check.h
new file mode 100644
index 000000000..8390f5088
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/i386/fma-check.h
@@ -0,0 +1,25 @@
+#include <stdlib.h>
+
+#include "cpuid.h"
+
+static void fma_test (void);
+
+static void __attribute__ ((noinline)) do_test (void)
+{
+ fma_test ();
+}
+
+int
+main ()
+{
+ unsigned int eax, ebx, ecx, edx;
+
+ if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx))
+ return 0;
+
+ /* Run FMA test only if host has FMA support. */
+ if (ecx & bit_FMA)
+ do_test ();
+
+ return 0;
+}