mirror of
https://github.com/golang/go
synced 2024-11-19 10:04:56 -07:00
runtime: use internal/cpu in alginit
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>
This commit is contained in:
parent
144fae8ed5
commit
6b5236ae53
@ -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
|
||||
}
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user