OSDN Git Service

new repo
[bytom/vapor.git] / vendor / golang.org / x / crypto / blake2s / blake2s_amd64.go
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
5 // +build amd64,!gccgo,!appengine
6
7 package blake2s
8
9 var (
10         useSSE4  = supportSSE4()
11         useSSSE3 = supportSSSE3()
12         useSSE2  = true // Always available on amd64
13 )
14
15 //go:noescape
16 func supportSSSE3() bool
17
18 //go:noescape
19 func supportSSE4() bool
20
21 //go:noescape
22 func hashBlocksSSE2(h *[8]uint32, c *[2]uint32, flag uint32, blocks []byte)
23
24 //go:noescape
25 func hashBlocksSSSE3(h *[8]uint32, c *[2]uint32, flag uint32, blocks []byte)
26
27 //go:noescape
28 func hashBlocksSSE4(h *[8]uint32, c *[2]uint32, flag uint32, blocks []byte)
29
30 func hashBlocks(h *[8]uint32, c *[2]uint32, flag uint32, blocks []byte) {
31         if useSSE4 {
32                 hashBlocksSSE4(h, c, flag, blocks)
33         } else if useSSSE3 {
34                 hashBlocksSSSE3(h, c, flag, blocks)
35         } else if useSSE2 {
36                 hashBlocksSSE2(h, c, flag, blocks)
37         } else {
38                 hashBlocksGeneric(h, c, flag, blocks)
39         }
40 }