]> Cypherpunks repositories - gostls13.git/commitdiff
internal/cpu: fix and cleanup ARM64 cpu feature fields and options
authorMartin Möhrmann <moehrmann@google.com>
Thu, 5 Nov 2020 04:59:34 +0000 (05:59 +0100)
committerMartin Möhrmann <moehrmann@google.com>
Thu, 5 Nov 2020 10:46:08 +0000 (10:46 +0000)
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>

src/internal/cpu/cpu.go
src/internal/cpu/cpu_arm64.go

index 0ceedcd7d223ec69fba3860f45d45ac61d66ef92..dab5d068ef36e4ef5bf1d028bced35fc7cd5fa94 100644 (file)
@@ -57,30 +57,13 @@ var ARM struct {
 // The struct is padded to avoid false sharing.
 var ARM64 struct {
        _            CacheLinePad
-       HasFP        bool
-       HasASIMD     bool
-       HasEVTSTRM   bool
        HasAES       bool
        HasPMULL     bool
        HasSHA1      bool
        HasSHA2      bool
        HasCRC32     bool
        HasATOMICS   bool
-       HasFPHP      bool
-       HasASIMDHP   bool
        HasCPUID     bool
-       HasASIMDRDM  bool
-       HasJSCVT     bool
-       HasFCMA      bool
-       HasLRCPC     bool
-       HasDCPOP     bool
-       HasSHA3      bool
-       HasSM3       bool
-       HasSM4       bool
-       HasASIMDDP   bool
-       HasSHA512    bool
-       HasSVE       bool
-       HasASIMDFHM  bool
        IsNeoverseN1 bool
        IsZeus       bool
        _            CacheLinePad
index 8fde39f03e1051ba47c8c9dcbb51a865b78c95e9..4e9ea8ca96155e0a2fe2fddbc2bcd57fd81e39e6 100644 (file)
@@ -29,6 +29,7 @@ func doinit() {
                {Name: "sha2", Feature: &ARM64.HasSHA2},
                {Name: "crc32", Feature: &ARM64.HasCRC32},
                {Name: "atomics", Feature: &ARM64.HasATOMICS},
+               {Name: "cpuid", Feature: &ARM64.HasCPUID},
                {Name: "isNeoverseN1", Feature: &ARM64.IsNeoverseN1},
                {Name: "isZeus", Feature: &ARM64.IsZeus},
        }