aboutsummaryrefslogtreecommitdiff
path: root/src/simd
diff options
context:
space:
mode:
authorJunyang Shao <shaojunyang@google.com>2025-07-15 21:38:28 +0000
committerDavid Chase <drchase@google.com>2025-07-21 14:26:04 -0700
commit41054cdb1cd9f2a7400668d385ec1a030d90389c (patch)
tree718774b79107c2cf5477190e4411407319540560 /src/simd
parent957f06c410db08ac7bc5dea19fce2c6187c95d6a (diff)
downloadgo-41054cdb1cd9f2a7400668d385ec1a030d90389c.tar.xz
[dev.simd] simd, internal/cpu: support more AVX CPU Feature checks
This CL adds more checks, it also changes HasAVX512GFNI to be exactly checking GFNI instead of being a virtual feature. This CL copies its logic from x/sys/arch. Change-Id: I4612b0409b8a3518928300562ae08bcf123d53a7 Reviewed-on: https://go-review.googlesource.com/c/go/+/688276 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
Diffstat (limited to 'src/simd')
-rw-r--r--src/simd/cpu.go46
1 files changed, 43 insertions, 3 deletions
diff --git a/src/simd/cpu.go b/src/simd/cpu.go
index 5ff47b8873..7bc5116525 100644
--- a/src/simd/cpu.go
+++ b/src/simd/cpu.go
@@ -11,12 +11,52 @@ package simd
import "internal/cpu"
-// HasAVX512GFNI checks AVX512 CPU feature F+CD+BW+DQ+VL+GFNI.
-func HasAVX512GFNI() bool {
- return cpu.X86.HasAVX512GFNI
+// HasAVX checks AVX CPU feature.
+func HasAVX() bool {
+ return cpu.X86.HasAVX
+}
+
+// HasAVXVNNI checks AVX CPU feature VNNI.
+func HasAVXVNNI() bool {
+ return cpu.X86.HasAVXVNNI
+}
+
+// HasAVX2 checks AVX2 CPU feature.
+func HasAVX2() bool {
+ return cpu.X86.HasAVX2
}
// HasAVX512 checks AVX512 CPU feature F+CD+BW+DQ+VL.
func HasAVX512() bool {
return cpu.X86.HasAVX512
}
+
+// HasAVX512GFNI checks AVX512 CPU feature GFNI.
+func HasAVX512GFNI() bool {
+ return cpu.X86.HasAVX512GFNI
+}
+
+// HasAVX512VBMI checks AVX512 CPU feature VBMI
+func HasAVX512VBMI() bool {
+ return cpu.X86.HasAVX512VBMI
+}
+
+// HasAVX512VBMI2 checks AVX512 CPU feature VBMI2
+func HasAVX512VBMI2() bool {
+ return cpu.X86.HasAVX512VBMI2
+}
+
+// HasAVX512VNNI checks AVX512 CPU feature VNNI
+func HasAVX512VNNI() bool {
+ return cpu.X86.HasAVX512VNNI
+}
+
+// HasAVX512VPOPCNTDQ checks AVX512 CPU feature VPOPCNTDQ
+func HasAVX512VPOPCNTDQ() bool {
+ return cpu.X86.HasAVX512VPOPCNTDQ
+}
+
+// HasAVX512BITALG checks AVX512 CPU feature BITALG
+func HasAVX512BITALG() bool {
+ return cpu.X86.HasAVX512BITALG
+}