mirror of
https://github.com/golang/go
synced 2024-11-24 15:00:14 -07:00
crypto: check all cpu.X86 flags for features used in assembly
These are most likely redundant, but cmd/compile/internal/amd64's TestGoAMD64v1 turns them off when clobbering those instructions, so we need to know to skip the assembly in those cases. Thankfully we have Avo now that adds a helpful comment with the list of features used by each generated function! Also improve the error output of TestGoAMD64v1. It had broken before in #49402 and had required the exact same patch. Change-Id: I7fab8f36042cdff630f806723aa1d8124c294f60 Reviewed-on: https://go-review.googlesource.com/c/go/+/626876 Auto-Submit: Filippo Valsorda <filippo@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Russ Cox <rsc@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Daniel McCarney <daniel@binaryparadox.net> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
e66229a22a
commit
bedde1bee0
@ -78,7 +78,7 @@ func TestGoAMD64v1(t *testing.T) {
|
||||
cmd.Env = append(cmd.Env, fmt.Sprintf("GODEBUG=%s", strings.Join(features, ",")))
|
||||
out, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
t.Fatalf("couldn't execute test: %s", err)
|
||||
t.Fatalf("couldn't execute test: %s\n%s", err, out)
|
||||
}
|
||||
// Expect to see output of the form "PASS\n", unless the test binary
|
||||
// was compiled for coverage (in which case there will be an extra line).
|
||||
|
@ -11,8 +11,8 @@ import (
|
||||
"internal/cpu"
|
||||
)
|
||||
|
||||
var useAVX2 = cpu.X86.HasAVX2 && cpu.X86.HasBMI2
|
||||
var useSHANI = useAVX2 && cpu.X86.HasSHA
|
||||
var useAVX2 = cpu.X86.HasAVX && cpu.X86.HasAVX2 && cpu.X86.HasBMI2
|
||||
var useSHANI = cpu.X86.HasAVX && cpu.X86.HasSHA && cpu.X86.HasSSE41 && cpu.X86.HasSSSE3
|
||||
|
||||
func init() {
|
||||
impl.Register("sha256", "AVX2", &useAVX2)
|
||||
|
@ -11,7 +11,7 @@ import (
|
||||
"internal/cpu"
|
||||
)
|
||||
|
||||
var useAVX2 = cpu.X86.HasAVX2 && cpu.X86.HasBMI1 && cpu.X86.HasBMI2
|
||||
var useAVX2 = cpu.X86.HasAVX && cpu.X86.HasAVX2 && cpu.X86.HasBMI2
|
||||
|
||||
func init() {
|
||||
impl.Register("sha512", "AVX2", &useAVX2)
|
||||
|
@ -14,7 +14,7 @@ func blockAVX2(dig *digest, p []byte)
|
||||
//go:noescape
|
||||
func blockAMD64(dig *digest, p []byte)
|
||||
|
||||
var useAVX2 = cpu.X86.HasAVX2 && cpu.X86.HasBMI1 && cpu.X86.HasBMI2
|
||||
var useAVX2 = cpu.X86.HasAVX && cpu.X86.HasAVX2 && cpu.X86.HasBMI1 && cpu.X86.HasBMI2
|
||||
|
||||
func block(dig *digest, p []byte) {
|
||||
if useAVX2 && len(p) >= 256 {
|
||||
|
Loading…
Reference in New Issue
Block a user