gcc/testsuite/gcc.target/x86_64/abi/avx/avx-check.h
raw| 1 | #include <stdlib.h> |
| 2 | #include "cpuid.h" |
| 3 | |
| 4 | static void avx_test (void); |
| 5 | |
| 6 | int |
| 7 | main () |
| 8 | { |
| 9 | unsigned int eax, ebx, ecx, edx; |
| 10 | |
| 11 | if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx)) |
| 12 | return 0; |
| 13 | |
| 14 | /* Run AVX test only if host has AVX support. */ |
| 15 | if ((ecx & (bit_AVX | bit_OSXSAVE)) == (bit_AVX | bit_OSXSAVE)) |
| 16 | { |
| 17 | avx_test (); |
| 18 | #ifdef DEBUG |
| 19 | __builtin_printf ("PASSED\n"); |
| 20 | #endif |
| 21 | } |
| 22 | #ifdef DEBUG |
| 23 | else |
| 24 | __builtin_printf ("SKIPPED\n"); |
| 25 | #endif |
| 26 | |
| 27 | return 0; |
| 28 | } |