forked from templexxx/reedsolomon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mul_amd64.go
48 lines (41 loc) · 1.08 KB
/
mul_amd64.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright (c) 2017 Temple3x (temple3x@gmail.com)
//
// Use of this source code is governed by the MIT License
// that can be found in the LICENSE file.
package reedsolomon
// Coefficient multiply by vector(d).
// Then write result(p).
func mulVect(c byte, d, p []byte, cpuFeature int) {
switch cpuFeature {
case avx512:
tbl := lowHighTbl[int(c)*32 : int(c)*32+32]
mulVectAVX512(tbl, d, p)
case avx2:
tbl := lowHighTbl[int(c)*32 : int(c)*32+32]
mulVectAVX2(tbl, d, p)
default:
mulVectBase(c, d, p)
}
}
// Coefficient multiply by vector(d).
// Then update result(p) by XOR old result(p).
func mulVectXOR(c byte, d, p []byte, cpuFeature int) {
switch cpuFeature {
case avx512:
tbl := lowHighTbl[int(c)*32 : int(c)*32+32]
mulVectXORAVX512(tbl, d, p)
case avx2:
tbl := lowHighTbl[int(c)*32 : int(c)*32+32]
mulVectXORAVX2(tbl, d, p)
default:
mulVectXORBase(c, d, p)
}
}
//go:noescape
func mulVectAVX2(tbl, d, p []byte)
//go:noescape
func mulVectXORAVX2(tbl, d, p []byte)
//go:noescape
func mulVectAVX512(tbl, d, p []byte)
//go:noescape
func mulVectXORAVX512(tbl, d, p []byte)