sha512block_amd64.go 509 B

12345678910111213141516171819202122232425
  1. // Copyright 2013 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. //go:build ignore && amd64
  5. package sha512
  6. import "internal/cpu"
  7. //go:noescape
  8. func blockAVX2(dig *digest, p []byte)
  9. //go:noescape
  10. func blockAMD64(dig *digest, p []byte)
  11. var useAVX2 = cpu.X86.HasAVX2 && cpu.X86.HasBMI1 && cpu.X86.HasBMI2
  12. func block(dig *digest, p []byte) {
  13. if useAVX2 {
  14. blockAVX2(dig, p)
  15. } else {
  16. blockAMD64(dig, p)
  17. }
  18. }