]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: use internal/cpu in alginit
authorMeng Zhuo <mengzhuo1203@gmail.com>
Tue, 10 Apr 2018 08:42:44 +0000 (16:42 +0800)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 10 Apr 2018 16:33:26 +0000 (16:33 +0000)
After CL 104636 the feature flags in internal/cpu are initialized before
alginit and can now be used for aeshash feature detection. Also remove
now unused runtime variables:
x86:
support_ssse3
support_sse42
support_aes
arm64:
support_aes

Change-Id: I2f64198d91750eaf3c6cf2aac6e9e17615811ec8
Reviewed-on: https://go-review.googlesource.com/106015
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/runtime/alg.go
src/runtime/asm_386.s
src/runtime/asm_amd64.s
src/runtime/asm_amd64p32.s
src/runtime/os_linux_arm64.go
src/runtime/runtime2.go

index cc723e49e26527f78306d31ae0d6c14cfdaa56ef..8e931fd7658c6cbc0c6d2754311fe06dc334a6ab 100644 (file)
@@ -5,6 +5,7 @@
 package runtime
 
 import (
+       "internal/cpu"
        "runtime/internal/sys"
        "unsafe"
 )
@@ -282,13 +283,13 @@ func alginit() {
        // Install AES hash algorithms if the instructions needed are present.
        if (GOARCH == "386" || GOARCH == "amd64") &&
                GOOS != "nacl" &&
-               support_aes && // AESENC
-               support_ssse3 && // PSHUFB
-               support_sse41 { // PINSR{D,Q}
+               cpu.X86.HasAES && // AESENC
+               cpu.X86.HasSSSE3 && // PSHUFB
+               cpu.X86.HasSSE41 { // PINSR{D,Q}
                initAlgAES()
                return
        }
-       if GOARCH == "arm64" && arm64_support_aes {
+       if GOARCH == "arm64" && cpu.ARM64.HasAES {
                initAlgAES()
                return
        }
index 806361b6b882f9aaa2f7a131298a6f6ec9a717fb..4ba1d5b278f0dc5a29499e76c3c9512488659bfc 100644 (file)
@@ -167,21 +167,12 @@ notintel:
        TESTL   $(1<<26), DX // SSE2
        SETNE   runtime·support_sse2(SB)
 
-       TESTL   $(1<<9), DI // SSSE3
-       SETNE   runtime·support_ssse3(SB)
-
        TESTL   $(1<<19), DI // SSE4.1
        SETNE   runtime·support_sse41(SB)
 
-       TESTL   $(1<<20), DI // SSE4.2
-       SETNE   runtime·support_sse42(SB)
-
        TESTL   $(1<<23), DI // POPCNT
        SETNE   runtime·support_popcnt(SB)
 
-       TESTL   $(1<<25), DI // AES
-       SETNE   runtime·support_aes(SB)
-
        TESTL   $(1<<27), DI // OSXSAVE
        SETNE   runtime·support_osxsave(SB)
 
index db516b54929fea0a43432d9ca2353547dc3ec664..a8357f0e9741e29784105758aa50937053ea7be6 100644 (file)
@@ -130,21 +130,12 @@ notintel:
        TESTL   $(1<<26), DX // SSE2
        SETNE   runtime·support_sse2(SB)
 
-       TESTL   $(1<<9), CX // SSSE3
-       SETNE   runtime·support_ssse3(SB)
-
        TESTL   $(1<<19), CX // SSE4.1
        SETNE   runtime·support_sse41(SB)
 
-       TESTL   $(1<<20), CX // SSE4.2
-       SETNE   runtime·support_sse42(SB)
-
        TESTL   $(1<<23), CX // POPCNT
        SETNE   runtime·support_popcnt(SB)
 
-       TESTL   $(1<<25), CX // AES
-       SETNE   runtime·support_aes(SB)
-
        TESTL   $(1<<27), CX // OSXSAVE
        SETNE   runtime·support_osxsave(SB)
 
index 04f78d8d9385fbfdfcadcee09ac949b1b9a27fb8..e58e5ec90f8ac74c83aa1a84b2e329c6b08909a9 100644 (file)
@@ -50,21 +50,12 @@ notintel:
        TESTL   $(1<<26), DX // SSE2
        SETNE   runtime·support_sse2(SB)
 
-       TESTL   $(1<<9), CX // SSSE3
-       SETNE   runtime·support_ssse3(SB)
-
        TESTL   $(1<<19), CX // SSE4.1
        SETNE   runtime·support_sse41(SB)
 
-       TESTL   $(1<<20), CX // SSE4.2
-       SETNE   runtime·support_sse42(SB)
-
        TESTL   $(1<<23), CX // POPCNT
        SETNE   runtime·support_popcnt(SB)
 
-       TESTL   $(1<<25), CX // AES
-       SETNE   runtime·support_aes(SB)
-
        TESTL   $(1<<27), CX // OSXSAVE
        SETNE   runtime·support_osxsave(SB)
 
index 9342a042ac61ed6316686e083800feb65e2c11f7..ed4af0dd41fd6cde387bb2b89ca93565cea2ec15 100644 (file)
@@ -29,7 +29,6 @@ func archauxv(tag, val uintptr) {
                randomNumber = uint32(startupRandomData[4]) | uint32(startupRandomData[5])<<8 |
                        uint32(startupRandomData[6])<<16 | uint32(startupRandomData[7])<<24
        case _AT_HWCAP:
-               arm64_support_aes = ((val>>3)&0x1 == 0x1)
                cpu_hwcap = uint(val)
        case _AT_HWCAP2:
                cpu_hwcap2 = uint(val)
index ee5f6d5b47ff2c309b72d03945804bdfe7bcbf3d..22ba375a932ae56892eabf0ca57f2feeb021f37e 100644 (file)
@@ -771,7 +771,6 @@ var (
        processorVersionInfo uint32
        isIntel              bool
        lfenceBeforeRdtsc    bool
-       support_aes          bool
        support_avx          bool
        support_avx2         bool
        support_erms         bool
@@ -779,10 +778,6 @@ var (
        support_popcnt       bool
        support_sse2         bool
        support_sse41        bool
-       support_sse42        bool
-       support_ssse3        bool
-
-       arm64_support_aes bool
 
        goarm                uint8 // set by cmd/link on arm systems
        framepointer_enabled bool  // set by cmd/link