blob: 8575080303560a3d44bc429700e66e816c4da1bb [file] [log] [blame]
Andreas Auernhammer4428aee2016-10-12 21:11:18 +02001// 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
Adam Langleyb2fa06b2016-10-28 10:07:08 -07005// +build 386,!gccgo,!appengine
Andreas Auernhammer4428aee2016-10-12 21:11:18 +02006
7package blake2s
8
9var (
Austin Clements814723e2016-10-21 16:39:25 -040010 useSSE4 = false
11 useSSSE3 = supportSSSE3()
12 useSSE2 = supportSSE2()
13 useGeneric = true
Andreas Auernhammer4428aee2016-10-12 21:11:18 +020014)
15
16//go:noescape
17func supportSSE2() bool
18
19//go:noescape
20func supportSSSE3() bool
21
22//go:noescape
23func hashBlocksSSE2(h *[8]uint32, c *[2]uint32, flag uint32, blocks []byte)
24
25//go:noescape
26func hashBlocksSSSE3(h *[8]uint32, c *[2]uint32, flag uint32, blocks []byte)
27
28func hashBlocks(h *[8]uint32, c *[2]uint32, flag uint32, blocks []byte) {
29 if useSSSE3 {
30 hashBlocksSSSE3(h, c, flag, blocks)
31 } else if useSSE2 {
32 hashBlocksSSE2(h, c, flag, blocks)
33 } else {
34 hashBlocksGeneric(h, c, flag, blocks)
35 }
36}