(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
i386/
avx2-check.h
       1  #include <stdlib.h>
       2  #include "cpuid.h"
       3  #include "m256-check.h"
       4  #include "avx-os-support.h"
       5  
       6  static void avx2_test (void);
       7  
       8  static void __attribute__ ((noinline)) do_test (void)
       9  {
      10    avx2_test ();
      11  }
      12  
      13  static int
      14  check_osxsave (void)
      15  {
      16    unsigned int eax, ebx, ecx, edx;
      17  
      18    __cpuid (1, eax, ebx, ecx, edx);
      19    return (ecx & bit_OSXSAVE) != 0;
      20  }
      21  
      22  int
      23  main ()
      24  {
      25    unsigned int eax, ebx, ecx, edx;
      26  
      27    if (!__get_cpuid_count (7, 0, &eax, &ebx, &ecx, &edx))
      28      return 0;
      29  
      30    /* Run AVX2 test only if host has AVX2 support.  */
      31    if (check_osxsave () && (ebx & bit_AVX2) && avx_os_support ())
      32      {
      33        do_test ();
      34  #ifdef DEBUG
      35        printf ("PASSED\n");
      36  #endif
      37        return 0;
      38      }
      39  
      40  #ifdef DEBUG
      41    printf ("SKIPPED\n");
      42  #endif
      43    return 0;
      44  }