aboutsummaryrefslogtreecommitdiff
path: root/src/simd/archsimd
diff options
context:
space:
mode:
Diffstat (limited to 'src/simd/archsimd')
-rw-r--r--src/simd/archsimd/_gen/simdgen/xed.go5
-rw-r--r--src/simd/archsimd/cpu.go10
-rw-r--r--src/simd/archsimd/ops_amd64.go8
3 files changed, 18 insertions, 5 deletions
diff --git a/src/simd/archsimd/_gen/simdgen/xed.go b/src/simd/archsimd/_gen/simdgen/xed.go
index 5d6fac64d0..2175fa4a8d 100644
--- a/src/simd/archsimd/_gen/simdgen/xed.go
+++ b/src/simd/archsimd/_gen/simdgen/xed.go
@@ -77,7 +77,8 @@ func loadXED(xedPath string) []*unify.Value {
switch {
case inst.RealOpcode == "N":
return // Skip unstable instructions
- case !(strings.HasPrefix(inst.Extension, "AVX") || strings.HasPrefix(inst.Extension, "SHA") || inst.Extension == "FMA"):
+ case !(strings.HasPrefix(inst.Extension, "AVX") || strings.HasPrefix(inst.Extension, "SHA") ||
+ inst.Extension == "FMA" || inst.Extension == "VAES"):
// We're only interested in AVX and SHA instructions.
return
}
@@ -796,6 +797,7 @@ var cpuFeatureMap = map[string]string{
"AVXAES": "AVXAES",
"SHA": "SHA",
"FMA": "FMA",
+ "VAES": "VAES",
// AVX-512 foundational features. We combine all of these into one "AVX512" feature.
"AVX512F": "AVX512",
@@ -829,6 +831,7 @@ func init() {
"AVXAES": {Virtual: true, Implies: []string{"AVX", "AES"}},
"FMA": {Implies: []string{"AVX"}},
+ "VAES": {Implies: []string{"AVX"}},
// AVX-512 subfeatures.
"AVX512BITALG": {Implies: []string{"AVX512"}},
diff --git a/src/simd/archsimd/cpu.go b/src/simd/archsimd/cpu.go
index 8069ee7f26..a25556ae65 100644
--- a/src/simd/archsimd/cpu.go
+++ b/src/simd/archsimd/cpu.go
@@ -158,3 +158,13 @@ func (X86Features) FMA() bool {
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
+}
diff --git a/src/simd/archsimd/ops_amd64.go b/src/simd/archsimd/ops_amd64.go
index ec50cc72c5..9c5bb22eee 100644
--- a/src/simd/archsimd/ops_amd64.go
+++ b/src/simd/archsimd/ops_amd64.go
@@ -19,7 +19,7 @@ func (x Uint8x16) AESDecryptLastRound(y Uint32x4) Uint8x16
// y is the chunk of dw array in use.
// result = AddRoundKey(InvShiftRows(InvSubBytes(x)), y)
//
-// Asm: VAESDECLAST, CPU Feature: AVX512VAES
+// Asm: VAESDECLAST, CPU Feature: VAES
func (x Uint8x32) AESDecryptLastRound(y Uint32x8) Uint8x32
// AESDecryptLastRound performs a series of operations in AES cipher algorithm defined in FIPS 197.
@@ -45,7 +45,7 @@ func (x Uint8x16) AESDecryptOneRound(y Uint32x4) Uint8x16
// y is the chunk of dw array in use.
// result = AddRoundKey(InvMixColumns(InvShiftRows(InvSubBytes(x))), y)
//
-// Asm: VAESDEC, CPU Feature: AVX512VAES
+// Asm: VAESDEC, CPU Feature: VAES
func (x Uint8x32) AESDecryptOneRound(y Uint32x8) Uint8x32
// AESDecryptOneRound performs a series of operations in AES cipher algorithm defined in FIPS 197.
@@ -71,7 +71,7 @@ func (x Uint8x16) AESEncryptLastRound(y Uint32x4) Uint8x16
// y is the chunk of w array in use.
// result = AddRoundKey((ShiftRows(SubBytes(x))), y)
//
-// Asm: VAESENCLAST, CPU Feature: AVX512VAES
+// Asm: VAESENCLAST, CPU Feature: VAES
func (x Uint8x32) AESEncryptLastRound(y Uint32x8) Uint8x32
// AESEncryptLastRound performs a series of operations in AES cipher algorithm defined in FIPS 197.
@@ -97,7 +97,7 @@ func (x Uint8x16) AESEncryptOneRound(y Uint32x4) Uint8x16
// y is the chunk of w array in use.
// result = AddRoundKey(MixColumns(ShiftRows(SubBytes(x))), y)
//
-// Asm: VAESENC, CPU Feature: AVX512VAES
+// Asm: VAESENC, CPU Feature: VAES
func (x Uint8x32) AESEncryptOneRound(y Uint32x8) Uint8x32
// AESEncryptOneRound performs a series of operations in AES cipher algorithm defined in FIPS 197.