github.com/devops-filetransfer/sshego@v7.0.4+incompatible/_vendor/golang.org/x/crypto/blake2b/blake2bAVX2_amd64.go (about) 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 go1.7,amd64,!gccgo,!appengine 6 7 package blake2b 8 9 func init() { 10 useAVX2 = supportsAVX2() 11 useAVX = supportsAVX() 12 useSSE4 = supportsSSE4() 13 } 14 15 //go:noescape 16 func supportsSSE4() bool 17 18 //go:noescape 19 func supportsAVX() bool 20 21 //go:noescape 22 func supportsAVX2() bool 23 24 //go:noescape 25 func hashBlocksAVX2(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte) 26 27 //go:noescape 28 func hashBlocksAVX(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte) 29 30 //go:noescape 31 func hashBlocksSSE4(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte) 32 33 func hashBlocks(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte) { 34 if useAVX2 { 35 hashBlocksAVX2(h, c, flag, blocks) 36 } else if useAVX { 37 hashBlocksAVX(h, c, flag, blocks) 38 } else if useSSE4 { 39 hashBlocksSSE4(h, c, flag, blocks) 40 } else { 41 hashBlocksGeneric(h, c, flag, blocks) 42 } 43 }