OSDN Git Service

Merge pull request #41 from Bytom/dev
[bytom/vapor.git] / vendor / github.com / minio / blake2b-simd / compressSse_amd64.go
1 //+build !noasm
2 //+build !appengine
3
4 /*
5  * Minio Cloud Storage, (C) 2016 Minio, Inc.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *     http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19
20 package blake2b
21
22 //go:noescape
23 func blockSSELoop(p []uint8, in, iv, t, f, shffle, out []uint64)
24
25 func compressSSE(d *digest, p []uint8) {
26         var (
27                 in     [8]uint64
28                 out    [8]uint64
29                 shffle [2]uint64
30         )
31
32         // vector for PSHUFB instruction
33         shffle[0] = 0x0201000706050403
34         shffle[1] = 0x0a09080f0e0d0c0b
35
36         in[0], in[1], in[2], in[3], in[4], in[5], in[6], in[7] = d.h[0], d.h[1], d.h[2], d.h[3], d.h[4], d.h[5], d.h[6], d.h[7]
37
38         blockSSELoop(p, in[:], iv[:], d.t[:], d.f[:], shffle[:], out[:])
39
40         d.h[0], d.h[1], d.h[2], d.h[3], d.h[4], d.h[5], d.h[6], d.h[7] = out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7]
41 }