mirror of
https://github.com/rwinkhart/sys.git
synced 2026-09-02 07:07:33 -04:00
cpu: add support for detecting AVX-512
The existing implementation hasn't AVX-512 detection support. This patch extends cpu package with such a functionality. Fixes golang/go#41288 Change-Id: Iaddd57c5ff6d73360b77886458b9210b6c446859 Reviewed-on: https://go-review.googlesource.com/c/sys/+/257937 Trust: Tobias Klauser <tobias.klauser@gmail.com> Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
This commit is contained in:
committed by
Tobias Klauser
parent
9d91bd6205
commit
006507a758
@@ -30,6 +30,17 @@ func TestAVX2hasAVX(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestAVX512HasAVX2AndAVX(t *testing.T) {
|
||||
if runtime.GOARCH == "amd64" {
|
||||
if cpu.X86.HasAVX512 && !cpu.X86.HasAVX {
|
||||
t.Fatal("HasAVX expected true, got false")
|
||||
}
|
||||
if cpu.X86.HasAVX512 && !cpu.X86.HasAVX2 {
|
||||
t.Fatal("HasAVX2 expected true, got false")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestARM64minimalFeatures(t *testing.T) {
|
||||
if runtime.GOARCH != "arm64" || (runtime.GOOS == "darwin" || runtime.GOOS == "ios") {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user