| 1 |
#include <stdlib.h> |
| 2 |
#include "cpuid.h" |
| 3 |
#include "m256-check.h" |
| 4 |
#include "avx-os-support.h" |
| 5 |
|
| 6 |
static void avx_test (void); |
| 7 |
|
| 8 |
static void |
| 9 |
__attribute__ ((noinline)) |
| 10 |
do_test (void) |
| 11 |
{ |
| 12 |
avx_test (); |
| 13 |
} |
| 14 |
|
| 15 |
int |
| 16 |
main () |
| 17 |
{ |
| 18 |
unsigned int eax, ebx, ecx, edx; |
| 19 |
|
| 20 |
if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx)) |
| 21 |
return 0; |
| 22 |
|
| 23 |
/* Run AVX test only if host has AVX support. */ |
| 24 |
if (((ecx & (bit_AVX | bit_OSXSAVE)) == (bit_AVX | bit_OSXSAVE)) |
| 25 |
&& avx_os_support () |
| 26 |
#ifdef AVXIFMA |
| 27 |
&& __builtin_cpu_supports ("avxifma") |
| 28 |
#endif |
| 29 |
#ifdef AVXVNNIINT8 |
| 30 |
&& __builtin_cpu_supports ("avxvnniint8") |
| 31 |
#endif |
| 32 |
#ifdef AVXNECONVERT |
| 33 |
&& __builtin_cpu_supports ("avxneconvert") |
| 34 |
#endif |
| 35 |
#ifdef AVXVNNIINT16 |
| 36 |
&& __builtin_cpu_supports ("avxvnniint16") |
| 37 |
#endif |
| 38 |
) |
| 39 |
{ |
| 40 |
do_test (); |
| 41 |
#ifdef DEBUG |
| 42 |
printf ("PASSED\n"); |
| 43 |
#endif |
| 44 |
} |
| 45 |
#ifdef DEBUG |
| 46 |
else |
| 47 |
printf ("SKIPPED\n"); |
| 48 |
#endif |
| 49 |
|
| 50 |
return 0; |
| 51 |
} |