Andreas Auernhammer | 4428aee | 2016-10-12 21:11:18 +0200 | [diff] [blame] | 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 | |
Adam Langley | b2fa06b | 2016-10-28 10:07:08 -0700 | [diff] [blame] | 5 | // +build amd64,!gccgo,!appengine |
Andreas Auernhammer | 4428aee | 2016-10-12 21:11:18 +0200 | [diff] [blame] | 6 | |
| 7 | package blake2s |
| 8 | |
| 9 | var ( |
Austin Clements | 814723e | 2016-10-21 16:39:25 -0400 | [diff] [blame] | 10 | useSSE4 = supportSSE4() |
| 11 | useSSSE3 = supportSSSE3() |
| 12 | useSSE2 = true // Always available on amd64 |
| 13 | useGeneric = false |
Andreas Auernhammer | 4428aee | 2016-10-12 21:11:18 +0200 | [diff] [blame] | 14 | ) |
| 15 | |
| 16 | //go:noescape |
| 17 | func supportSSSE3() bool |
| 18 | |
| 19 | //go:noescape |
| 20 | func supportSSE4() bool |
| 21 | |
| 22 | //go:noescape |
| 23 | func hashBlocksSSE2(h *[8]uint32, c *[2]uint32, flag uint32, blocks []byte) |
| 24 | |
| 25 | //go:noescape |
| 26 | func hashBlocksSSSE3(h *[8]uint32, c *[2]uint32, flag uint32, blocks []byte) |
| 27 | |
| 28 | //go:noescape |
| 29 | func hashBlocksSSE4(h *[8]uint32, c *[2]uint32, flag uint32, blocks []byte) |
| 30 | |
| 31 | func hashBlocks(h *[8]uint32, c *[2]uint32, flag uint32, blocks []byte) { |
| 32 | if useSSE4 { |
| 33 | hashBlocksSSE4(h, c, flag, blocks) |
| 34 | } else if useSSSE3 { |
| 35 | hashBlocksSSSE3(h, c, flag, blocks) |
| 36 | } else { |
| 37 | hashBlocksSSE2(h, c, flag, blocks) |
| 38 | } |
| 39 | } |