diff options
| author | Carlos Amedee <carlos@golang.org> | 2026-01-21 15:45:40 -0500 |
|---|---|---|
| committer | Carlos Amedee <carlos@golang.org> | 2026-01-21 15:56:01 -0500 |
| commit | eec3c0ca956803db8a90dfd92ce4ebffebdaf9b4 (patch) | |
| tree | 14ed37a5aa0fd9e80b547fd43086b2b137457726 /src/simd/archsimd/cpu.go | |
| parent | 4606a931d2b099f2c5e5619b797352607ee42225 (diff) | |
| parent | 2baa1d17628bb2f09757617382b1e61f1f9f0ddd (diff) | |
| download | go-eec3c0ca956803db8a90dfd92ce4ebffebdaf9b4.tar.xz | |
[release-branch.go1.26] all: merge master (2baa1d1) into release-branch.go1.26
For #76474.
Change-Id: Ic50e288f99b731b62af9aa73ce6721f0f2f3596d
Diffstat (limited to 'src/simd/archsimd/cpu.go')
| -rw-r--r-- | src/simd/archsimd/cpu.go | 48 |
1 files changed, 40 insertions, 8 deletions
diff --git a/src/simd/archsimd/cpu.go b/src/simd/archsimd/cpu.go index d0c0ff5426..8069ee7f26 100644 --- a/src/simd/archsimd/cpu.go +++ b/src/simd/archsimd/cpu.go @@ -10,14 +10,6 @@ type X86Features struct{} var X86 X86Features -// AES returns whether the CPU supports the AES feature. -// -// AES is defined on all GOARCHes, but will only return true on -// GOARCH amd64. -func (X86Features) AES() bool { - return cpu.X86.HasAES -} - // AVX returns whether the CPU supports the AVX feature. // // AVX is defined on all GOARCHes, but will only return true on @@ -28,6 +20,8 @@ func (X86Features) AVX() bool { // 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 { @@ -41,6 +35,8 @@ func (X86Features) AVX2() bool { // 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 { @@ -49,6 +45,8 @@ func (X86Features) AVX512() bool { // 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 { @@ -57,6 +55,8 @@ func (X86Features) AVX512BITALG() bool { // 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 { @@ -65,6 +65,8 @@ func (X86Features) AVX512GFNI() bool { // 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 { @@ -73,6 +75,8 @@ func (X86Features) AVX512VAES() bool { // 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 { @@ -81,6 +85,8 @@ func (X86Features) AVX512VBMI() bool { // 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 { @@ -89,6 +95,8 @@ func (X86Features) AVX512VBMI2() bool { // 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 { @@ -105,20 +113,44 @@ func (X86Features) AVX512VPCLMULQDQ() bool { // 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 |
