...
1
2
3
4
5
6
7 package blake2b
8
9 import "golang.org/x/sys/cpu"
10
11 func init() {
12 useAVX2 = cpu.X86.HasAVX2
13 useAVX = cpu.X86.HasAVX
14 useSSE4 = cpu.X86.HasSSE41
15 }
16
17
18 func hashBlocksAVX2(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte)
19
20
21 func hashBlocksAVX(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte)
22
23
24 func hashBlocksSSE4(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte)
25
26 func hashBlocks(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte) {
27 switch {
28 case useAVX2:
29 hashBlocksAVX2(h, c, flag, blocks)
30 case useAVX:
31 hashBlocksAVX(h, c, flag, blocks)
32 case useSSE4:
33 hashBlocksSSE4(h, c, flag, blocks)
34 default:
35 hashBlocksGeneric(h, c, flag, blocks)
36 }
37 }
38
View as plain text