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.
9 const cacheLineSize = 64
13 {Name: "fp", Feature: &ARM64.HasFP},
14 {Name: "asimd", Feature: &ARM64.HasASIMD},
15 {Name: "evstrm", Feature: &ARM64.HasEVTSTRM},
16 {Name: "aes", Feature: &ARM64.HasAES},
17 {Name: "fphp", Feature: &ARM64.HasFPHP},
18 {Name: "jscvt", Feature: &ARM64.HasJSCVT},
19 {Name: "lrcpc", Feature: &ARM64.HasLRCPC},
20 {Name: "pmull", Feature: &ARM64.HasPMULL},
21 {Name: "sha1", Feature: &ARM64.HasSHA1},
22 {Name: "sha2", Feature: &ARM64.HasSHA2},
23 {Name: "sha3", Feature: &ARM64.HasSHA3},
24 {Name: "sha512", Feature: &ARM64.HasSHA512},
25 {Name: "sm3", Feature: &ARM64.HasSM3},
26 {Name: "sm4", Feature: &ARM64.HasSM4},
27 {Name: "sve", Feature: &ARM64.HasSVE},
28 {Name: "crc32", Feature: &ARM64.HasCRC32},
29 {Name: "atomics", Feature: &ARM64.HasATOMICS},
30 {Name: "asimdhp", Feature: &ARM64.HasASIMDHP},
31 {Name: "cpuid", Feature: &ARM64.HasCPUID},
32 {Name: "asimrdm", Feature: &ARM64.HasASIMDRDM},
33 {Name: "fcma", Feature: &ARM64.HasFCMA},
34 {Name: "dcpop", Feature: &ARM64.HasDCPOP},
35 {Name: "asimddp", Feature: &ARM64.HasASIMDDP},
36 {Name: "asimdfhm", Feature: &ARM64.HasASIMDFHM},
44 case "linux", "netbsd":
47 // Most platforms don't seem to allow reading these registers.
50 // See https://golang.org/issue/31746
55 // setMinimalFeatures fakes the minimal ARM64 features expected by
56 // TestARM64minimalFeatures.
57 func setMinimalFeatures() {
62 func readARM64Registers() {
65 parseARM64SystemRegisters(getisar0(), getisar1(), getpfr0())
68 func parseARM64SystemRegisters(isar0, isar1, pfr0 uint64) {
70 switch extractBits(isar0, 4, 7) {
78 switch extractBits(isar0, 8, 11) {
83 switch extractBits(isar0, 12, 15) {
88 ARM64.HasSHA512 = true
91 switch extractBits(isar0, 16, 19) {
96 switch extractBits(isar0, 20, 23) {
98 ARM64.HasATOMICS = true
101 switch extractBits(isar0, 28, 31) {
103 ARM64.HasASIMDRDM = true
106 switch extractBits(isar0, 32, 35) {
111 switch extractBits(isar0, 36, 39) {
116 switch extractBits(isar0, 40, 43) {
121 switch extractBits(isar0, 44, 47) {
123 ARM64.HasASIMDDP = true
127 switch extractBits(isar1, 0, 3) {
129 ARM64.HasDCPOP = true
132 switch extractBits(isar1, 12, 15) {
134 ARM64.HasJSCVT = true
137 switch extractBits(isar1, 16, 19) {
142 switch extractBits(isar1, 20, 23) {
144 ARM64.HasLRCPC = true
148 switch extractBits(pfr0, 16, 19) {
156 switch extractBits(pfr0, 20, 23) {
158 ARM64.HasASIMD = true
160 ARM64.HasASIMD = true
161 ARM64.HasASIMDHP = true
164 switch extractBits(pfr0, 32, 35) {
170 func extractBits(data uint64, start, end uint) uint {
171 return (uint)(data>>start) & ((1 << (end - start + 1)) - 1)