1  #include <stdlib.h>
       2  #include "cpuid.h"
       3  
       4  static void avx512f_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  #define DEBUG
      15    /* Run AVX test only if host has AVX support.  */
      16    if ((ecx & bit_OSXSAVE) == bit_OSXSAVE)
      17      {
      18        if (__get_cpuid_max (0, NULL) < 7)
      19  	return 0;
      20  
      21        __cpuid_count (7, 0, eax, ebx, ecx, edx);
      22  
      23        if ((ebx & bit_AVX512F) == bit_AVX512F)
      24  	{
      25  	  avx512f_test ();
      26  #ifdef DEBUG
      27  	  printf ("PASSED\n");
      28  #endif
      29  	}
      30  #ifdef DEBUG
      31        else
      32  	printf ("SKIPPED\n");
      33  #endif
      34      }
      35  #ifdef DEBUG
      36    else
      37      printf ("SKIPPED\n");
      38  #endif
      39  
      40    return 0;
      41  }