Source file src/simd/archsimd/cpu.go

     1  // Code generated by 'simdgen -o godefs -goroot $GOROOT -xedPath $XED_PATH go.yaml types.yaml categories.yaml'; DO NOT EDIT.
     2  
     3  //go:build goexperiment.simd
     4  
     5  package archsimd
     6  
     7  import "internal/cpu"
     8  
     9  type X86Features struct{}
    10  
    11  var X86 X86Features
    12  
    13  // AVX returns whether the CPU supports the AVX feature.
    14  //
    15  // AVX is defined on all GOARCHes, but will only return true on
    16  // GOARCH amd64.
    17  func (X86Features) AVX() bool {
    18  	return cpu.X86.HasAVX
    19  }
    20  
    21  // AVX2 returns whether the CPU supports the AVX2 feature.
    22  //
    23  // If it returns true, then the CPU also supports AVX.
    24  //
    25  // AVX2 is defined on all GOARCHes, but will only return true on
    26  // GOARCH amd64.
    27  func (X86Features) AVX2() bool {
    28  	return cpu.X86.HasAVX2
    29  }
    30  
    31  // AVX512 returns whether the CPU supports the AVX512F+CD+BW+DQ+VL features.
    32  //
    33  // These five CPU features are bundled together, and no use of AVX-512
    34  // is allowed unless all of these features are supported together.
    35  // Nearly every CPU that has shipped with any support for AVX-512 has
    36  // supported all five of these features.
    37  //
    38  // If it returns true, then the CPU also supports AVX and AVX2.
    39  //
    40  // AVX512 is defined on all GOARCHes, but will only return true on
    41  // GOARCH amd64.
    42  func (X86Features) AVX512() bool {
    43  	return cpu.X86.HasAVX512
    44  }
    45  
    46  // AVX512BITALG returns whether the CPU supports the AVX512BITALG feature.
    47  //
    48  // If it returns true, then the CPU also supports AVX, AVX2, and AVX512.
    49  //
    50  // AVX512BITALG is defined on all GOARCHes, but will only return true on
    51  // GOARCH amd64.
    52  func (X86Features) AVX512BITALG() bool {
    53  	return cpu.X86.HasAVX512BITALG
    54  }
    55  
    56  // AVX512GFNI returns whether the CPU supports the AVX512GFNI feature.
    57  //
    58  // If it returns true, then the CPU also supports AVX, AVX2, and AVX512.
    59  //
    60  // AVX512GFNI is defined on all GOARCHes, but will only return true on
    61  // GOARCH amd64.
    62  func (X86Features) AVX512GFNI() bool {
    63  	return cpu.X86.HasAVX512GFNI
    64  }
    65  
    66  // AVX512VAES returns whether the CPU supports the AVX512VAES feature.
    67  //
    68  // If it returns true, then the CPU also supports AVX, AVX2, and AVX512.
    69  //
    70  // AVX512VAES is defined on all GOARCHes, but will only return true on
    71  // GOARCH amd64.
    72  func (X86Features) AVX512VAES() bool {
    73  	return cpu.X86.HasAVX512VAES
    74  }
    75  
    76  // AVX512VBMI returns whether the CPU supports the AVX512VBMI feature.
    77  //
    78  // If it returns true, then the CPU also supports AVX, AVX2, and AVX512.
    79  //
    80  // AVX512VBMI is defined on all GOARCHes, but will only return true on
    81  // GOARCH amd64.
    82  func (X86Features) AVX512VBMI() bool {
    83  	return cpu.X86.HasAVX512VBMI
    84  }
    85  
    86  // AVX512VBMI2 returns whether the CPU supports the AVX512VBMI2 feature.
    87  //
    88  // If it returns true, then the CPU also supports AVX, AVX2, and AVX512.
    89  //
    90  // AVX512VBMI2 is defined on all GOARCHes, but will only return true on
    91  // GOARCH amd64.
    92  func (X86Features) AVX512VBMI2() bool {
    93  	return cpu.X86.HasAVX512VBMI2
    94  }
    95  
    96  // AVX512VNNI returns whether the CPU supports the AVX512VNNI feature.
    97  //
    98  // If it returns true, then the CPU also supports AVX, AVX2, and AVX512.
    99  //
   100  // AVX512VNNI is defined on all GOARCHes, but will only return true on
   101  // GOARCH amd64.
   102  func (X86Features) AVX512VNNI() bool {
   103  	return cpu.X86.HasAVX512VNNI
   104  }
   105  
   106  // AVX512VPCLMULQDQ returns whether the CPU supports the AVX512VPCLMULQDQ feature.
   107  //
   108  // AVX512VPCLMULQDQ is defined on all GOARCHes, but will only return true on
   109  // GOARCH amd64.
   110  func (X86Features) AVX512VPCLMULQDQ() bool {
   111  	return cpu.X86.HasAVX512VPCLMULQDQ
   112  }
   113  
   114  // AVX512VPOPCNTDQ returns whether the CPU supports the AVX512VPOPCNTDQ feature.
   115  //
   116  // If it returns true, then the CPU also supports AVX, AVX2, and AVX512.
   117  //
   118  // AVX512VPOPCNTDQ is defined on all GOARCHes, but will only return true on
   119  // GOARCH amd64.
   120  func (X86Features) AVX512VPOPCNTDQ() bool {
   121  	return cpu.X86.HasAVX512VPOPCNTDQ
   122  }
   123  
   124  // AVXAES returns whether the CPU supports the AVXAES feature.
   125  //
   126  // If it returns true, then the CPU also supports AES and AVX.
   127  //
   128  // AVXAES is defined on all GOARCHes, but will only return true on
   129  // GOARCH amd64.
   130  func (X86Features) AVXAES() bool {
   131  	return cpu.X86.HasAVX && cpu.X86.HasAES
   132  }
   133  
   134  // AVXVNNI returns whether the CPU supports the AVXVNNI feature.
   135  //
   136  // If it returns true, then the CPU also supports AVX and AVX2.
   137  //
   138  // AVXVNNI is defined on all GOARCHes, but will only return true on
   139  // GOARCH amd64.
   140  func (X86Features) AVXVNNI() bool {
   141  	return cpu.X86.HasAVXVNNI
   142  }
   143  
   144  // FMA returns whether the CPU supports the FMA feature.
   145  //
   146  // If it returns true, then the CPU also supports AVX.
   147  //
   148  // FMA is defined on all GOARCHes, but will only return true on
   149  // GOARCH amd64.
   150  func (X86Features) FMA() bool {
   151  	return cpu.X86.HasFMA
   152  }
   153  
   154  // SHA returns whether the CPU supports the SHA feature.
   155  //
   156  // SHA is defined on all GOARCHes, but will only return true on
   157  // GOARCH amd64.
   158  func (X86Features) SHA() bool {
   159  	return cpu.X86.HasSHA
   160  }
   161  

View as plain text