33 lines
888 B
Go
33 lines
888 B
Go
// Copyright 2017 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
// Package cpu implements processor feature detection
|
|
// used by the Go standard libary.
|
|
package cpufeat
|
|
|
|
var X86 x86
|
|
|
|
// The booleans in x86 contain the correspondingly named cpuid feature bit.
|
|
// HasAVX and HasAVX2 are only set if the OS does support XMM and YMM registers
|
|
// in addition to the cpuid feature bit being set.
|
|
// The struct is padded to avoid false sharing.
|
|
type x86 struct {
|
|
_ [CacheLineSize]byte
|
|
HasAES bool
|
|
HasAVX bool
|
|
HasAVX2 bool
|
|
HasBMI1 bool
|
|
HasBMI2 bool
|
|
HasERMS bool
|
|
HasOSXSAVE bool
|
|
HasPCLMULQDQ bool
|
|
HasPOPCNT bool
|
|
HasSSE2 bool
|
|
HasSSE3 bool
|
|
HasSSSE3 bool
|
|
HasSSE41 bool
|
|
HasSSE42 bool
|
|
_ [CacheLineSize]byte
|
|
}
|