blake2s_amd64.go 866 B

12345678910111213141516171819202122232425262728293031323334353637
  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 amd64, !gccgo, !appengine
  5. package blake2s
  6. var (
  7. useSSE4 = supportSSE4()
  8. useSSSE3 = supportSSSE3()
  9. )
  10. //go:noescape
  11. func supportSSSE3() bool
  12. //go:noescape
  13. func supportSSE4() bool
  14. //go:noescape
  15. func hashBlocksSSE2(h *[8]uint32, c *[2]uint32, flag uint32, blocks []byte)
  16. //go:noescape
  17. func hashBlocksSSSE3(h *[8]uint32, c *[2]uint32, flag uint32, blocks []byte)
  18. //go:noescape
  19. func hashBlocksSSE4(h *[8]uint32, c *[2]uint32, flag uint32, blocks []byte)
  20. func hashBlocks(h *[8]uint32, c *[2]uint32, flag uint32, blocks []byte) {
  21. if useSSE4 {
  22. hashBlocksSSE4(h, c, flag, blocks)
  23. } else if useSSSE3 {
  24. hashBlocksSSSE3(h, c, flag, blocks)
  25. } else {
  26. hashBlocksSSE2(h, c, flag, blocks)
  27. }
  28. }