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