github.com/primecitizens/pcz/std@v0.2.1/core/cpu/cpu_mips64x.go (about) 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright 2023 The Prime Citizens 3 // 4 // Copyright 2019 The Go Authors. All rights reserved. 5 // Use of this source code is governed by a BSD-style 6 // license that can be found in the LICENSE file. 7 8 //go:build mips64 || mips64le 9 10 package cpu 11 12 const CacheLinePadSize = 32 13 14 // HWCAP bits. These are exposed by the Linux kernel 5.4. 15 const ( 16 // CPU features 17 hwcap_MIPS_MSA = 1 << 1 18 ) 19 20 var ( 21 // This is initialized by archauxv and should not be changed after it is 22 // initialized. 23 HWCap uint 24 25 MIPS64X struct { 26 _ CacheLinePad 27 HasMSA bool // MIPS SIMD architecture 28 _ CacheLinePad 29 } 30 31 options = []option{ 32 {Name: "msa", Feature: &MIPS64X.HasMSA}, 33 } 34 ) 35 36 func doinit() { 37 // HWCAP feature bits 38 MIPS64X.HasMSA = isSet(HWCap, hwcap_MIPS_MSA) 39 } 40 41 func isSet(hwc uint, value uint) bool { 42 return hwc&value != 0 43 }