2017-02-08 14:31:54 -07:00
|
|
|
// Copyright 2013 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.
|
|
|
|
|
|
|
|
// +build amd64
|
|
|
|
|
|
|
|
package sha512
|
|
|
|
|
2017-04-03 14:38:09 -06:00
|
|
|
import "internal/cpu"
|
|
|
|
|
2017-02-08 14:31:54 -07:00
|
|
|
//go:noescape
|
|
|
|
func blockAVX2(dig *digest, p []byte)
|
|
|
|
|
|
|
|
//go:noescape
|
|
|
|
func blockAMD64(dig *digest, p []byte)
|
|
|
|
|
2017-04-03 14:38:09 -06:00
|
|
|
var useAVX2 = cpu.X86.HasAVX2 && cpu.X86.HasBMI1 && cpu.X86.HasBMI2
|
2017-02-08 14:31:54 -07:00
|
|
|
|
|
|
|
func block(dig *digest, p []byte) {
|
2017-04-03 14:38:09 -06:00
|
|
|
if useAVX2 {
|
2017-02-08 14:31:54 -07:00
|
|
|
blockAVX2(dig, p)
|
|
|
|
} else {
|
|
|
|
blockAMD64(dig, p)
|
|
|
|
}
|
|
|
|
}
|