(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
i386/
avx512-check.h
       1  #include <stdlib.h>
       2  #include "cpuid.h"
       3  #include "m512-check.h"
       4  #include "avx512f-os-support.h"
       5  
       6  #ifndef DO_TEST
       7  #define DO_TEST do_test
       8  #ifdef AVX512VL
       9  static void test_256 (void);
      10  static void test_128 (void);
      11  #else
      12  static void test_512 (void);
      13  #endif
      14  
      15  __attribute__ ((noinline))
      16  static void
      17  do_test (void)
      18  {
      19  #ifdef AVX512VL
      20    test_256 ();
      21    test_128 ();
      22  #else
      23    test_512 ();
      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    unsigned int eax, ebx, ecx, edx;
      41  
      42    if (!__get_cpuid_count (7, 0, &eax, &ebx, &ecx, &edx))
      43      return 0;
      44  
      45    /* Run AVX512 test only if host has ISA support.  */
      46    if (check_osxsave ()
      47        && (ebx & bit_AVX512F)
      48  #ifdef AVX512VL
      49        && (ebx & bit_AVX512VL)
      50  #endif
      51  #ifdef AVX512ER
      52        && (ebx & bit_AVX512ER)
      53  #endif
      54  #ifdef AVX512CD
      55        && (ebx & bit_AVX512CD)
      56  #endif
      57  #ifdef AVX512DQ
      58        && (ebx & bit_AVX512DQ)
      59  #endif
      60  #ifdef AVX512BW
      61        && (ebx & bit_AVX512BW)
      62  #endif
      63  #ifdef AVX512IFMA
      64        && (ebx & bit_AVX512IFMA)
      65  #endif
      66  #ifdef AVX512VBMI
      67        && (ecx & bit_AVX512VBMI)
      68  #endif
      69  #ifdef AVX5124FMAPS
      70        && (edx & bit_AVX5124FMAPS)
      71  #endif
      72  #ifdef AVX5124VNNIW
      73        && (edx & bit_AVX5124VNNIW)
      74  #endif
      75  #ifdef AVX512VPOPCNTDQ
      76        && (ecx & bit_AVX512VPOPCNTDQ)
      77  #endif
      78  #ifdef AVX512BITALG
      79        && (ecx & bit_AVX512BITALG)
      80  #endif
      81  #ifdef GFNI
      82        && (ecx & bit_GFNI)
      83  #endif
      84  #ifdef AVX512VBMI2
      85        && (ecx & bit_AVX512VBMI2)
      86  #endif
      87  #ifdef AVX512VNNI
      88        && (ecx & bit_AVX512VNNI)
      89  #endif
      90  #ifdef AVX512FP16
      91        && (edx & bit_AVX512FP16)
      92  #endif
      93  #ifdef VAES
      94        && (ecx & bit_VAES)
      95  #endif
      96  #ifdef VPCLMULQDQ
      97        && (ecx & bit_VPCLMULQDQ)
      98  #endif
      99  #ifdef AVX512VP2INTERSECT
     100        && (edx & bit_AVX512VP2INTERSECT)
     101  #endif
     102        && avx512f_os_support ())
     103      {
     104        DO_TEST ();
     105  #ifdef DEBUG
     106        printf ("PASSED\n");
     107  #endif
     108        return 0;
     109      }
     110   
     111  #ifdef DEBUG
     112    printf ("SKIPPED\n");
     113  #endif
     114    return 0;
     115  }