aboutsummaryrefslogtreecommitdiff
path: root/src/simd
diff options
context:
space:
mode:
authorJunyang Shao <shaojunyang@google.com>2025-07-01 18:00:33 +0000
committerJunyang Shao <shaojunyang@google.com>2025-07-01 13:51:57 -0700
commit1ee72a15a3e893c82cc7108c49f141e824f941c2 (patch)
tree9a5f10330952e6386ba00a5e6eb5ceab9b79867b /src/simd
parent0710cce6eb0d75db1fc6c45807773f40edb14d73 (diff)
downloadgo-1ee72a15a3e893c82cc7108c49f141e824f941c2.tar.xz
[dev.simd] internal/cpu: add GFNI feature check
This CL amends HasAVX512 flag with GFNI check. This is needed because our SIMD API supports Galois Field operations. Change-Id: I3e957b7b2215d2b7b6b8a7a0ca3e2e60d453b2e5 Reviewed-on: https://go-review.googlesource.com/c/go/+/685295 Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/simd')
-rw-r--r--src/simd/cpu.go5
-rw-r--r--src/simd/simd_test.go8
2 files changed, 9 insertions, 4 deletions
diff --git a/src/simd/cpu.go b/src/simd/cpu.go
index b07b5288f2..5ff47b8873 100644
--- a/src/simd/cpu.go
+++ b/src/simd/cpu.go
@@ -11,6 +11,11 @@ package simd
import "internal/cpu"
+// HasAVX512GFNI checks AVX512 CPU feature F+CD+BW+DQ+VL+GFNI.
+func HasAVX512GFNI() bool {
+ return cpu.X86.HasAVX512GFNI
+}
+
// HasAVX512 checks AVX512 CPU feature F+CD+BW+DQ+VL.
func HasAVX512() bool {
return cpu.X86.HasAVX512
diff --git a/src/simd/simd_test.go b/src/simd/simd_test.go
index 084b0af539..59908d60c5 100644
--- a/src/simd/simd_test.go
+++ b/src/simd/simd_test.go
@@ -38,7 +38,7 @@ func TestType(t *testing.T) {
v.y = &y
sink = y
- if !simd.HasAVX512() {
+ if !simd.HasAVX512GFNI() {
t.Skip("Test requires HasAVX512, not available on this hardware")
return
}
@@ -97,7 +97,7 @@ func TestReflectMethod(t *testing.T) {
}
func TestVectorConversion(t *testing.T) {
- if !simd.HasAVX512() {
+ if !simd.HasAVX512GFNI() {
t.Skip("Test requires HasAVX512, not available on this hardware")
return
}
@@ -115,7 +115,7 @@ func TestVectorConversion(t *testing.T) {
}
func TestMaskConversion(t *testing.T) {
- if !simd.HasAVX512() {
+ if !simd.HasAVX512GFNI() {
t.Skip("Test requires HasAVX512, not available on this hardware")
return
}
@@ -144,7 +144,7 @@ func TestSub(t *testing.T) {
}
func TestMaskedAdd(t *testing.T) {
- if !simd.HasAVX512() {
+ if !simd.HasAVX512GFNI() {
t.Skip("Test requires HasAVX512, not available on this hardware")
return
}