Skip to content

Commit 3510a1e

Browse files
committed
internal/cpu: fix and cleanup ARM64 cpu feature fields and options
Remove all cpu features from the ARM64 struct that are not initialized to reduce cache lines used and to avoid those features being accidentially used without actual detection if they are present. Add missing option to mask the CPUID feature. Change-Id: I94bf90c0655de1af2218ac72117ac6c52adfc289 Reviewed-on: https://go-review.googlesource.com/c/go/+/267658 Run-TryBot: Martin Möhrmann <moehrmann@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com> Trust: Martin Möhrmann <moehrmann@google.com>
1 parent 3ef8562 commit 3510a1e

File tree

2 files changed

+1
-17
lines changed

2 files changed

+1
-17
lines changed

src/internal/cpu/cpu.go

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -57,30 +57,13 @@ var ARM struct {
5757
// The struct is padded to avoid false sharing.
5858
var ARM64 struct {
5959
_ CacheLinePad
60-
HasFP bool
61-
HasASIMD bool
62-
HasEVTSTRM bool
6360
HasAES bool
6461
HasPMULL bool
6562
HasSHA1 bool
6663
HasSHA2 bool
6764
HasCRC32 bool
6865
HasATOMICS bool
69-
HasFPHP bool
70-
HasASIMDHP bool
7166
HasCPUID bool
72-
HasASIMDRDM bool
73-
HasJSCVT bool
74-
HasFCMA bool
75-
HasLRCPC bool
76-
HasDCPOP bool
77-
HasSHA3 bool
78-
HasSM3 bool
79-
HasSM4 bool
80-
HasASIMDDP bool
81-
HasSHA512 bool
82-
HasSVE bool
83-
HasASIMDFHM bool
8467
IsNeoverseN1 bool
8568
IsZeus bool
8669
_ CacheLinePad

src/internal/cpu/cpu_arm64.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ func doinit() {
2929
{Name: "sha2", Feature: &ARM64.HasSHA2},
3030
{Name: "crc32", Feature: &ARM64.HasCRC32},
3131
{Name: "atomics", Feature: &ARM64.HasATOMICS},
32+
{Name: "cpuid", Feature: &ARM64.HasCPUID},
3233
{Name: "isNeoverseN1", Feature: &ARM64.IsNeoverseN1},
3334
{Name: "isZeus", Feature: &ARM64.IsZeus},
3435
}

0 commit comments

Comments
 (0)