mirror of
https://github.com/golang/go.git
synced 2025-05-29 03:11:26 +00:00
When GO386=sse2 we can assume sse2 to be present without a runtime check. If GO386=softfloat is set we can avoid the usage of SSE2 even if detected. This might cause a memcpy, memclr and bytealg slowdown of Go binaries compiled with softfloat on machines that support SSE2. Such setups are rare and should use GO386=sse2 instead if performance matters. On targets that support SSE2 we avoid the runtime overhead of dynamic cpu feature dispatch. The removal of runtime sse2 checks also allows to simplify internal/cpu further by removing handling of the required feature option as a followup after this CL. Change-Id: I90a853a8853a405cb665497c6d1a86556947ba17 Reviewed-on: https://go-review.googlesource.com/c/go/+/344350 Trust: Martin Möhrmann <martin@golang.org> Run-TryBot: Martin Möhrmann <martin@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
35 lines
810 B
Go
35 lines
810 B
Go
// Copyright 2018 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package runtime
|
|
|
|
import (
|
|
"internal/cpu"
|
|
"unsafe"
|
|
)
|
|
|
|
// Offsets into internal/cpu records for use in assembly.
|
|
const (
|
|
offsetX86HasAVX = unsafe.Offsetof(cpu.X86.HasAVX)
|
|
offsetX86HasAVX2 = unsafe.Offsetof(cpu.X86.HasAVX2)
|
|
offsetX86HasERMS = unsafe.Offsetof(cpu.X86.HasERMS)
|
|
offsetX86HasRDTSCP = unsafe.Offsetof(cpu.X86.HasRDTSCP)
|
|
|
|
offsetARMHasIDIVA = unsafe.Offsetof(cpu.ARM.HasIDIVA)
|
|
|
|
offsetMIPS64XHasMSA = unsafe.Offsetof(cpu.MIPS64X.HasMSA)
|
|
)
|
|
|
|
var (
|
|
// Set in runtime.cpuinit.
|
|
// TODO: deprecate these; use internal/cpu directly.
|
|
x86HasPOPCNT bool
|
|
x86HasSSE41 bool
|
|
x86HasFMA bool
|
|
|
|
armHasVFPv4 bool
|
|
|
|
arm64HasATOMICS bool
|
|
)
|