blake2bAVX2_amd64.go 773 B

1234567891011121314151617181920212223242526272829303132
  1. // Copyright 2016 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. // +build go1.7,amd64,!gccgo,!appengine
  5. package blake2b
  6. var useAVX2 = supportAVX2()
  7. var useSSE4 = supportSSE4()
  8. //go:noescape
  9. func supportSSE4() bool
  10. //go:noescape
  11. func supportAVX2() bool
  12. //go:noescape
  13. func hashBlocksAVX2(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte)
  14. //go:noescape
  15. func hashBlocksSSE4(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte)
  16. func hashBlocks(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte) {
  17. if useAVX2 {
  18. hashBlocksAVX2(h, c, flag, blocks)
  19. } else if useSSE4 {
  20. hashBlocksSSE4(h, c, flag, blocks)
  21. } else {
  22. hashBlocksGeneric(h, c, flag, blocks)
  23. }
  24. }