diff options
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.target/i386/avx2-check.h')
-rw-r--r-- | gcc-4.9/gcc/testsuite/gcc.target/i386/avx2-check.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/i386/avx2-check.h b/gcc-4.9/gcc/testsuite/gcc.target/i386/avx2-check.h new file mode 100644 index 000000000..424335dbb --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/i386/avx2-check.h @@ -0,0 +1,47 @@ +#include <stdlib.h> +#include "cpuid.h" +#include "m256-check.h" +#include "avx-os-support.h" + +static void avx2_test (void); + +static void __attribute__ ((noinline)) do_test (void) +{ + avx2_test (); +} + +int +main () +{ + unsigned int eax, ebx, ecx, edx; + + if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx)) + return 0; + + /* Run AVX2 test only if host has AVX2 support. */ + if ((ecx & bit_OSXSAVE) == (bit_OSXSAVE)) + { + if (__get_cpuid_max (0, NULL) < 7) + return 0; + + __cpuid_count (7, 0, eax, ebx, ecx, edx); + + if ((avx_os_support ()) && ((ebx & bit_AVX2) == bit_AVX2)) + { + do_test (); +#ifdef DEBUG + printf ("PASSED\n"); +#endif + return 0; + } +#ifdef DEBUG + printf ("SKIPPED\n"); +#endif + } +#ifdef DEBUG + else + printf ("SKIPPED\n"); +#endif + + return 0; +} |