Commit 57020705 authored by Martin Möhrmann's avatar Martin Möhrmann

internal/cpu: make arm64 capability bits naming less verbose

This makes the constant names less verbose and aligns them more
with the Linux kernel which uses HWCAP_XXX for the constant names.

Change-Id: Ia7d079b59b57978adc045945951eaa1d99b41fac
Reviewed-on: https://go-review.googlesource.com/91738
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 0e1bcfc6
......@@ -16,28 +16,28 @@ var arm64_hwcap2 uint
// HWCAP/HWCAP2 bits. These are exposed by Linux.
const (
_ARM64_FEATURE_HAS_FP = (1 << 0)
_ARM64_FEATURE_HAS_ASIMD = (1 << 1)
_ARM64_FEATURE_HAS_EVTSTRM = (1 << 2)
_ARM64_FEATURE_HAS_AES = (1 << 3)
_ARM64_FEATURE_HAS_PMULL = (1 << 4)
_ARM64_FEATURE_HAS_SHA1 = (1 << 5)
_ARM64_FEATURE_HAS_SHA2 = (1 << 6)
_ARM64_FEATURE_HAS_CRC32 = (1 << 7)
_ARM64_FEATURE_HAS_ATOMICS = (1 << 8)
hwcap_FP = (1 << 0)
hwcap_ASIMD = (1 << 1)
hwcap_EVTSTRM = (1 << 2)
hwcap_AES = (1 << 3)
hwcap_PMULL = (1 << 4)
hwcap_SHA1 = (1 << 5)
hwcap_SHA2 = (1 << 6)
hwcap_CRC32 = (1 << 7)
hwcap_ATOMICS = (1 << 8)
)
func init() {
// HWCAP feature bits
ARM64.HasFP = isSet(arm64_hwcap, _ARM64_FEATURE_HAS_FP)
ARM64.HasASIMD = isSet(arm64_hwcap, _ARM64_FEATURE_HAS_ASIMD)
ARM64.HasEVTSTRM = isSet(arm64_hwcap, _ARM64_FEATURE_HAS_EVTSTRM)
ARM64.HasAES = isSet(arm64_hwcap, _ARM64_FEATURE_HAS_AES)
ARM64.HasPMULL = isSet(arm64_hwcap, _ARM64_FEATURE_HAS_PMULL)
ARM64.HasSHA1 = isSet(arm64_hwcap, _ARM64_FEATURE_HAS_SHA1)
ARM64.HasSHA2 = isSet(arm64_hwcap, _ARM64_FEATURE_HAS_SHA2)
ARM64.HasCRC32 = isSet(arm64_hwcap, _ARM64_FEATURE_HAS_CRC32)
ARM64.HasATOMICS = isSet(arm64_hwcap, _ARM64_FEATURE_HAS_ATOMICS)
ARM64.HasFP = isSet(arm64_hwcap, hwcap_FP)
ARM64.HasASIMD = isSet(arm64_hwcap, hwcap_ASIMD)
ARM64.HasEVTSTRM = isSet(arm64_hwcap, hwcap_EVTSTRM)
ARM64.HasAES = isSet(arm64_hwcap, hwcap_AES)
ARM64.HasPMULL = isSet(arm64_hwcap, hwcap_PMULL)
ARM64.HasSHA1 = isSet(arm64_hwcap, hwcap_SHA1)
ARM64.HasSHA2 = isSet(arm64_hwcap, hwcap_SHA2)
ARM64.HasCRC32 = isSet(arm64_hwcap, hwcap_CRC32)
ARM64.HasATOMICS = isSet(arm64_hwcap, hwcap_ATOMICS)
}
func isSet(hwc uint, value uint) bool {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment