gitee.com/ks-custle/core-gm@v0.0.0-20230922171213-b83bdd97b62c/internal/cpu/cpu_mips64x.go (about)

     1  // Copyright 2019 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  //go:build mips64 || mips64le
     6  // +build mips64 mips64le
     7  
     8  package cpu
     9  
    10  const CacheLinePadSize = 32
    11  
    12  // This is initialized by archauxv and should not be changed after it is
    13  // initialized.
    14  var HWCap uint
    15  
    16  // HWCAP bits. These are exposed by the Linux kernel 5.4.
    17  const (
    18  	// CPU features
    19  	hwcap_MIPS_MSA = 1 << 1
    20  )
    21  
    22  func doinit() {
    23  	options = []option{
    24  		{Name: "msa", Feature: &MIPS64X.HasMSA},
    25  	}
    26  
    27  	// HWCAP feature bits
    28  	MIPS64X.HasMSA = isSet(HWCap, hwcap_MIPS_MSA)
    29  }
    30  
    31  func isSet(hwc uint, value uint) bool {
    32  	return hwc&value != 0
    33  }