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 pclmul_avx_test (void);
       9  
      10  static void
      11  __attribute__ ((noinline))
      12  do_test (void)
      13  {
      14    pclmul_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 PCLMUL + AVX test only if host has PCLMUL + AVX support.  */
      26    if (((ecx & (bit_AVX | bit_OSXSAVE | bit_PCLMUL))
      27         == (bit_AVX | bit_OSXSAVE | bit_PCLMUL))
      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  }