Source file src/internal/cpu/cpu_loong64_hwcap.go

     1  // Copyright 2023 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 loong64 && linux
     6  
     7  package cpu
     8  
     9  // This is initialized by archauxv and should not be changed after it is
    10  // initialized.
    11  var HWCap uint
    12  
    13  // HWCAP bits. These are exposed by the Linux kernel.
    14  const (
    15  	hwcap_LOONGARCH_LSX = 1 << 4
    16  )
    17  
    18  func hwcapInit() {
    19  	// TODO: Features that require kernel support like LSX and LASX can
    20  	// be detected here once needed in std library or by the compiler.
    21  	Loong64.HasLSX = hwcIsSet(HWCap, hwcap_LOONGARCH_LSX)
    22  }
    23  
    24  func hwcIsSet(hwc uint, val uint) bool {
    25  	return hwc&val != 0
    26  }
    27  

View as plain text