File size: 5,025 Bytes
04dc9f2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
// Code generated by 'simdgen -o godefs -goroot $GOROOT -xedPath $XED_PATH go.yaml types.yaml categories.yaml'; DO NOT EDIT.

//go:build goexperiment.simd

package archsimd

import "internal/cpu"

type X86Features struct{}

var X86 X86Features

// AVX returns whether the CPU supports the AVX feature.
//
// AVX is defined on all GOARCHes, but will only return true on
// GOARCH amd64.
func (X86Features) AVX() bool {
	return cpu.X86.HasAVX
}

// AVX2 returns whether the CPU supports the AVX2 feature.
//
// If it returns true, then the CPU also supports AVX.
//
// AVX2 is defined on all GOARCHes, but will only return true on
// GOARCH amd64.
func (X86Features) AVX2() bool {
	return cpu.X86.HasAVX2
}

// AVX512 returns whether the CPU supports the AVX512F+CD+BW+DQ+VL features.
//
// These five CPU features are bundled together, and no use of AVX-512
// is allowed unless all of these features are supported together.
// Nearly every CPU that has shipped with any support for AVX-512 has
// supported all five of these features.
//
// If it returns true, then the CPU also supports AVX and AVX2.
//
// AVX512 is defined on all GOARCHes, but will only return true on
// GOARCH amd64.
func (X86Features) AVX512() bool {
	return cpu.X86.HasAVX512
}

// AVX512BITALG returns whether the CPU supports the AVX512BITALG feature.
//
// If it returns true, then the CPU also supports AVX, AVX2, and AVX512.
//
// AVX512BITALG is defined on all GOARCHes, but will only return true on
// GOARCH amd64.
func (X86Features) AVX512BITALG() bool {
	return cpu.X86.HasAVX512BITALG
}

// AVX512GFNI returns whether the CPU supports the AVX512GFNI feature.
//
// If it returns true, then the CPU also supports AVX, AVX2, and AVX512.
//
// AVX512GFNI is defined on all GOARCHes, but will only return true on
// GOARCH amd64.
func (X86Features) AVX512GFNI() bool {
	return cpu.X86.HasAVX512GFNI
}

// AVX512VAES returns whether the CPU supports the AVX512VAES feature.
//
// If it returns true, then the CPU also supports AVX, AVX2, and AVX512.
//
// AVX512VAES is defined on all GOARCHes, but will only return true on
// GOARCH amd64.
func (X86Features) AVX512VAES() bool {
	return cpu.X86.HasAVX512VAES
}

// AVX512VBMI returns whether the CPU supports the AVX512VBMI feature.
//
// If it returns true, then the CPU also supports AVX, AVX2, and AVX512.
//
// AVX512VBMI is defined on all GOARCHes, but will only return true on
// GOARCH amd64.
func (X86Features) AVX512VBMI() bool {
	return cpu.X86.HasAVX512VBMI
}

// AVX512VBMI2 returns whether the CPU supports the AVX512VBMI2 feature.
//
// If it returns true, then the CPU also supports AVX, AVX2, and AVX512.
//
// AVX512VBMI2 is defined on all GOARCHes, but will only return true on
// GOARCH amd64.
func (X86Features) AVX512VBMI2() bool {
	return cpu.X86.HasAVX512VBMI2
}

// AVX512VNNI returns whether the CPU supports the AVX512VNNI feature.
//
// If it returns true, then the CPU also supports AVX, AVX2, and AVX512.
//
// AVX512VNNI is defined on all GOARCHes, but will only return true on
// GOARCH amd64.
func (X86Features) AVX512VNNI() bool {
	return cpu.X86.HasAVX512VNNI
}

// AVX512VPCLMULQDQ returns whether the CPU supports the AVX512VPCLMULQDQ feature.
//
// AVX512VPCLMULQDQ is defined on all GOARCHes, but will only return true on
// GOARCH amd64.
func (X86Features) AVX512VPCLMULQDQ() bool {
	return cpu.X86.HasAVX512VPCLMULQDQ
}

// AVX512VPOPCNTDQ returns whether the CPU supports the AVX512VPOPCNTDQ feature.
//
// If it returns true, then the CPU also supports AVX, AVX2, and AVX512.
//
// AVX512VPOPCNTDQ is defined on all GOARCHes, but will only return true on
// GOARCH amd64.
func (X86Features) AVX512VPOPCNTDQ() bool {
	return cpu.X86.HasAVX512VPOPCNTDQ
}

// AVXAES returns whether the CPU supports the AVXAES feature.
//
// If it returns true, then the CPU also supports AES and AVX.
//
// AVXAES is defined on all GOARCHes, but will only return true on
// GOARCH amd64.
func (X86Features) AVXAES() bool {
	return cpu.X86.HasAVX && cpu.X86.HasAES
}

// AVXVNNI returns whether the CPU supports the AVXVNNI feature.
//
// If it returns true, then the CPU also supports AVX and AVX2.
//
// AVXVNNI is defined on all GOARCHes, but will only return true on
// GOARCH amd64.
func (X86Features) AVXVNNI() bool {
	return cpu.X86.HasAVXVNNI
}

// FMA returns whether the CPU supports the FMA feature.
//
// If it returns true, then the CPU also supports AVX.
//
// FMA is defined on all GOARCHes, but will only return true on
// GOARCH amd64.
func (X86Features) FMA() bool {
	return cpu.X86.HasFMA
}

// SHA returns whether the CPU supports the SHA feature.
//
// SHA is defined on all GOARCHes, but will only return true on
// GOARCH amd64.
func (X86Features) SHA() bool {
	return cpu.X86.HasSHA
}

// VAES returns whether the CPU supports the VAES feature.
//
// If it returns true, then the CPU also supports AVX.
//
// VAES is defined on all GOARCHes, but will only return true on
// GOARCH amd64.
func (X86Features) VAES() bool {
	return cpu.X86.HasVAES
}