github.com/zebozhuang/go@v0.0.0-20200207033046-f8a98f6f5c5d/src/internal/cpu/cpu.go (about)

     1  // Copyright 2017 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // Package cpu implements processor feature detection
     6  // used by the Go standard libary.
     7  package cpu
     8  
     9  var X86 x86
    10  
    11  // The booleans in x86 contain the correspondingly named cpuid feature bit.
    12  // HasAVX and HasAVX2 are only set if the OS does support XMM and YMM registers
    13  // in addition to the cpuid feature bit being set.
    14  // The struct is padded to avoid false sharing.
    15  type x86 struct {
    16  	_            [CacheLineSize]byte
    17  	HasAES       bool
    18  	HasAVX       bool
    19  	HasAVX2      bool
    20  	HasBMI1      bool
    21  	HasBMI2      bool
    22  	HasERMS      bool
    23  	HasOSXSAVE   bool
    24  	HasPCLMULQDQ bool
    25  	HasPOPCNT    bool
    26  	HasSSE2      bool
    27  	HasSSE3      bool
    28  	HasSSSE3     bool
    29  	HasSSE41     bool
    30  	HasSSE42     bool
    31  	_            [CacheLineSize]byte
    32  }