| 1 |
#include <stdlib.h> |
| 2 |
#include "cpuid.h" |
| 3 |
#include "m512-check.h" |
| 4 |
#include "avx10-os-support.h" |
| 5 |
|
| 6 |
#ifndef DO_TEST |
| 7 |
#define DO_TEST do_test |
| 8 |
#if defined(AVX10_512BIT) || defined(AVX10_SCALAR) |
| 9 |
static void test_512 (void); |
| 10 |
#else |
| 11 |
static void test_256 (void); |
| 12 |
static void test_128 (void); |
| 13 |
#endif |
| 14 |
|
| 15 |
__attribute__ ((noinline)) |
| 16 |
static void |
| 17 |
do_test (void) |
| 18 |
{ |
| 19 |
#if defined(AVX10_512BIT) || defined(AVX10_SCALAR) |
| 20 |
test_512 (); |
| 21 |
#else |
| 22 |
test_256 (); |
| 23 |
test_128 (); |
| 24 |
#endif |
| 25 |
} |
| 26 |
#endif |
| 27 |
|
| 28 |
static int |
| 29 |
check_osxsave (void) |
| 30 |
{ |
| 31 |
unsigned int eax, ebx, ecx, edx; |
| 32 |
|
| 33 |
__cpuid (1, eax, ebx, ecx, edx); |
| 34 |
return (ecx & bit_OSXSAVE) != 0; |
| 35 |
} |
| 36 |
|
| 37 |
int |
| 38 |
main () |
| 39 |
{ |
| 40 |
/* Run AVX10 test only if host has ISA support. */ |
| 41 |
if (__builtin_cpu_supports ("avx10.1") |
| 42 |
#ifdef AVX10_2 |
| 43 |
&& __builtin_cpu_supports ("avx10.2") |
| 44 |
#endif |
| 45 |
&& avx10_os_support ()) |
| 46 |
{ |
| 47 |
DO_TEST (); |
| 48 |
#ifdef DEBUG |
| 49 |
printf ("PASSED\n"); |
| 50 |
#endif |
| 51 |
return 0; |
| 52 |
} |
| 53 |
|
| 54 |
#ifdef DEBUG |
| 55 |
printf ("SKIPPED\n"); |
| 56 |
#endif |
| 57 |
return 0; |
| 58 |
} |