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//go:build 386 && gc && !purego
6// +build 386,gc,!purego
7
8package blake2s
9
10import "golang.org/x/sys/cpu"
11
12var (
13	useSSE4  = false
14	useSSSE3 = cpu.X86.HasSSSE3
15	useSSE2  = cpu.X86.HasSSE2
16)
17
18//go:noescape
19func hashBlocksSSE2(h *[8]uint32, c *[2]uint32, flag uint32, blocks []byte)
20
21//go:noescape
22func hashBlocksSSSE3(h *[8]uint32, c *[2]uint32, flag uint32, blocks []byte)
23
24func hashBlocks(h *[8]uint32, c *[2]uint32, flag uint32, blocks []byte) {
25	switch {
26	case useSSSE3:
27		hashBlocksSSSE3(h, c, flag, blocks)
28	case useSSE2:
29		hashBlocksSSE2(h, c, flag, blocks)
30	default:
31		hashBlocksGeneric(h, c, flag, blocks)
32	}
33}
34