github.com/gogf/gkafka@v1.0.1-0.20190702070843-033a14468069/third/golang.org/x/sys/cpu/cpu_arm64.go (about)

     1  // Copyright 2018 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
     6  
     7  const cacheLineSize = 64
     8  
     9  // HWCAP/HWCAP2 bits. These are exposed by Linux.
    10  const (
    11  	hwcap_FP       = 1 << 0
    12  	hwcap_ASIMD    = 1 << 1
    13  	hwcap_EVTSTRM  = 1 << 2
    14  	hwcap_AES      = 1 << 3
    15  	hwcap_PMULL    = 1 << 4
    16  	hwcap_SHA1     = 1 << 5
    17  	hwcap_SHA2     = 1 << 6
    18  	hwcap_CRC32    = 1 << 7
    19  	hwcap_ATOMICS  = 1 << 8
    20  	hwcap_FPHP     = 1 << 9
    21  	hwcap_ASIMDHP  = 1 << 10
    22  	hwcap_CPUID    = 1 << 11
    23  	hwcap_ASIMDRDM = 1 << 12
    24  	hwcap_JSCVT    = 1 << 13
    25  	hwcap_FCMA     = 1 << 14
    26  	hwcap_LRCPC    = 1 << 15
    27  	hwcap_DCPOP    = 1 << 16
    28  	hwcap_SHA3     = 1 << 17
    29  	hwcap_SM3      = 1 << 18
    30  	hwcap_SM4      = 1 << 19
    31  	hwcap_ASIMDDP  = 1 << 20
    32  	hwcap_SHA512   = 1 << 21
    33  	hwcap_SVE      = 1 << 22
    34  	hwcap_ASIMDFHM = 1 << 23
    35  )
    36  
    37  func doinit() {
    38  	// HWCAP feature bits
    39  	ARM64.HasFP = isSet(HWCap, hwcap_FP)
    40  	ARM64.HasASIMD = isSet(HWCap, hwcap_ASIMD)
    41  	ARM64.HasEVTSTRM = isSet(HWCap, hwcap_EVTSTRM)
    42  	ARM64.HasAES = isSet(HWCap, hwcap_AES)
    43  	ARM64.HasPMULL = isSet(HWCap, hwcap_PMULL)
    44  	ARM64.HasSHA1 = isSet(HWCap, hwcap_SHA1)
    45  	ARM64.HasSHA2 = isSet(HWCap, hwcap_SHA2)
    46  	ARM64.HasCRC32 = isSet(HWCap, hwcap_CRC32)
    47  	ARM64.HasATOMICS = isSet(HWCap, hwcap_ATOMICS)
    48  	ARM64.HasFPHP = isSet(HWCap, hwcap_FPHP)
    49  	ARM64.HasASIMDHP = isSet(HWCap, hwcap_ASIMDHP)
    50  	ARM64.HasCPUID = isSet(HWCap, hwcap_CPUID)
    51  	ARM64.HasASIMDRDM = isSet(HWCap, hwcap_ASIMDRDM)
    52  	ARM64.HasJSCVT = isSet(HWCap, hwcap_JSCVT)
    53  	ARM64.HasFCMA = isSet(HWCap, hwcap_FCMA)
    54  	ARM64.HasLRCPC = isSet(HWCap, hwcap_LRCPC)
    55  	ARM64.HasDCPOP = isSet(HWCap, hwcap_DCPOP)
    56  	ARM64.HasSHA3 = isSet(HWCap, hwcap_SHA3)
    57  	ARM64.HasSM3 = isSet(HWCap, hwcap_SM3)
    58  	ARM64.HasSM4 = isSet(HWCap, hwcap_SM4)
    59  	ARM64.HasASIMDDP = isSet(HWCap, hwcap_ASIMDDP)
    60  	ARM64.HasSHA512 = isSet(HWCap, hwcap_SHA512)
    61  	ARM64.HasSVE = isSet(HWCap, hwcap_SVE)
    62  	ARM64.HasASIMDFHM = isSet(HWCap, hwcap_ASIMDFHM)
    63  }
    64  
    65  func isSet(hwc uint, value uint) bool {
    66  	return hwc&value != 0
    67  }