| 1 |
#ifdef DEBUG |
| 2 |
#include <stdio.h> |
| 3 |
#endif |
| 4 |
#include <stdlib.h> |
| 5 |
#include "cpuid.h" |
| 6 |
#include "avx-os-support.h" |
| 7 |
|
| 8 |
static void aes_avx_test (void); |
| 9 |
|
| 10 |
static void |
| 11 |
__attribute__ ((noinline)) |
| 12 |
do_test (void) |
| 13 |
{ |
| 14 |
aes_avx_test (); |
| 15 |
} |
| 16 |
|
| 17 |
int |
| 18 |
main () |
| 19 |
{ |
| 20 |
unsigned int eax, ebx, ecx, edx; |
| 21 |
|
| 22 |
if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx)) |
| 23 |
return 0; |
| 24 |
|
| 25 |
/* Run AES + AVX test only if host has AES + AVX support. */ |
| 26 |
if (((ecx & (bit_AVX | bit_OSXSAVE | bit_AES)) |
| 27 |
== (bit_AVX | bit_OSXSAVE | bit_AES)) |
| 28 |
&& avx_os_support ()) |
| 29 |
{ |
| 30 |
do_test (); |
| 31 |
#ifdef DEBUG |
| 32 |
printf ("PASSED\n"); |
| 33 |
#endif |
| 34 |
} |
| 35 |
#ifdef DEBUG |
| 36 |
else |
| 37 |
printf ("SKIPPED\n"); |
| 38 |
#endif |
| 39 |
|
| 40 |
return 0; |
| 41 |
} |