Source file
src/simd/archsimd/slicepart_amd64.go
1
2
3
4
5
6
7 package archsimd
8
9
10
11
12
13
14 var vecMask64 = [16]int64{
15 -1, -1, -1, -1,
16 -1, -1, -1, -1,
17 0, 0, 0, 0,
18 0, 0, 0, 0,
19 }
20
21 var vecMask32 = [32]int32{
22 -1, -1, -1, -1,
23 -1, -1, -1, -1,
24 -1, -1, -1, -1,
25 -1, -1, -1, -1,
26 0, 0, 0, 0,
27 0, 0, 0, 0,
28 0, 0, 0, 0,
29 0, 0, 0, 0,
30 }
31
32
33
34
35
36
37 func LoadInt8x32Part(s []int8) (Int8x32, int) {
38 l := len(s)
39 if l >= 32 {
40 return LoadInt8x32(s), 32
41 }
42 var x Int8x32
43 if l == 0 {
44 return x, 0
45 }
46 if l > 16 {
47 v, _ := LoadInt8x16Part(s[16:])
48 return x.SetLo(LoadInt8x16(s)).SetHi(v), l
49 } else {
50 v, _ := LoadInt8x16Part(s)
51 return x.SetLo(v), l
52 }
53 }
54
55
56
57
58 func LoadInt16x16Part(s []int16) (Int16x16, int) {
59 l := len(s)
60 if l >= 16 {
61 return LoadInt16x16(s), 16
62 }
63 var x Int16x16
64 if l == 0 {
65 return x, 0
66 }
67 if l > 8 {
68 v, _ := LoadInt16x8Part(s[8:])
69 return x.SetLo(LoadInt16x8(s)).SetHi(v), l
70 } else {
71 v, _ := LoadInt16x8Part(s)
72 return x.SetLo(v), l
73 }
74 }
75
76
77
78
79 func (x Int8x32) StorePart(s []int8) int {
80 l := len(s)
81 if l >= 32 {
82 x.Store(s)
83 return 32
84 }
85 if l == 0 {
86 return 0
87 }
88 if l > 16 {
89 x.GetLo().Store(s)
90 x.GetHi().StorePart(s[16:])
91 } else {
92 x.GetLo().StorePart(s)
93 }
94 return l
95 }
96
97
98
99
100 func (x Int16x16) StorePart(s []int16) int {
101 l := len(s)
102 if l >= 16 {
103 x.Store(s)
104 return 16
105 }
106 if l == 0 {
107 return 0
108 }
109 if l > 8 {
110 x.GetLo().Store(s)
111 x.GetHi().StorePart(s[8:])
112 } else {
113 x.GetLo().StorePart(s)
114 }
115 return l
116 }
117
View as plain text