Source file
src/simd/archsimd/maskrange_amd64.go
1
2
3
4
5
6
7 package archsimd
8
9 import "math/bits"
10
11
12
13
14
15
16 func (x Mask8x16) All() bool {
17 return x.ToBits() == 0xffff
18 }
19
20
21
22
23 func (x Mask8x16) Any() bool {
24 return x.ToBits() != 0
25 }
26
27
28
29
30 func (x Mask8x16) None() bool {
31 return x.ToBits() == 0
32 }
33
34
35
36
37 func (x Mask16x8) All() bool {
38 return x.ToInt16x8().AsInt8x16().asMask().ToBits()&0x5555 == 0x5555
39 }
40
41
42
43
44 func (x Mask16x8) Any() bool {
45 return x.ToInt16x8().AsInt8x16().asMask().ToBits()&0x5555 != 0
46 }
47
48
49
50
51 func (x Mask16x8) None() bool {
52 return x.ToInt16x8().AsInt8x16().asMask().ToBits()&0x5555 == 0
53 }
54
55
56
57
58 func (x Mask32x4) All() bool {
59 return x.ToBits()&0x0f == 0x0f
60 }
61
62
63
64
65 func (x Mask32x4) Any() bool {
66 return x.ToBits()&0x0f != 0
67 }
68
69
70
71
72 func (x Mask32x4) None() bool {
73 return x.ToBits()&0x0f == 0
74 }
75
76
77
78
79 func (x Mask64x2) All() bool {
80 return x.ToBits()&0x03 == 0x03
81 }
82
83
84
85
86 func (x Mask64x2) Any() bool {
87 return x.ToBits()&0x03 != 0
88 }
89
90
91
92
93 func (x Mask64x2) None() bool {
94 return x.ToBits()&0x03 == 0
95 }
96
97
98
99
100
101
102 func (x Mask8x32) All() bool {
103 return x.ToBits() == 0xffffffff
104 }
105
106
107
108
109 func (x Mask8x32) Any() bool {
110 return x.ToBits() != 0
111 }
112
113
114
115
116 func (x Mask8x32) None() bool {
117 return x.ToBits() == 0
118 }
119
120
121
122
123 func (x Mask16x16) All() bool {
124 return x.ToInt16x16().AsInt8x32().asMask().ToBits()&0x55555555 == 0x55555555
125 }
126
127
128
129
130 func (x Mask16x16) Any() bool {
131 return x.ToInt16x16().AsInt8x32().asMask().ToBits()&0x55555555 != 0
132 }
133
134
135
136
137 func (x Mask16x16) None() bool {
138 return x.ToInt16x16().AsInt8x32().asMask().ToBits()&0x55555555 == 0
139 }
140
141
142
143
144 func (x Mask32x8) All() bool {
145 return x.ToBits() == 0xff
146 }
147
148
149
150
151 func (x Mask32x8) Any() bool {
152 return x.ToBits() != 0
153 }
154
155
156
157
158 func (x Mask32x8) None() bool {
159 return x.ToBits() == 0
160 }
161
162
163
164
165 func (x Mask64x4) All() bool {
166 return x.ToBits()&0x0f == 0x0f
167 }
168
169
170
171
172 func (x Mask64x4) Any() bool {
173 return x.ToBits()&0x0f != 0
174 }
175
176
177
178
179 func (x Mask64x4) None() bool {
180 return x.ToBits()&0x0f == 0
181 }
182
183
184
185
186
187
188 func (x Mask8x64) All() bool {
189 return ^x.ToBits() == 0
190 }
191
192
193
194
195 func (x Mask8x64) Any() bool {
196 return x.ToBits() != 0
197 }
198
199
200
201
202 func (x Mask8x64) None() bool {
203 return x.ToBits() == 0
204 }
205
206
207
208
209 func (x Mask16x32) All() bool {
210 return ^x.ToBits() == 0
211 }
212
213
214
215
216 func (x Mask16x32) Any() bool {
217 return x.ToBits() != 0
218 }
219
220
221
222
223 func (x Mask16x32) None() bool {
224 return x.ToBits() == 0
225 }
226
227
228
229
230 func (x Mask32x16) All() bool {
231 return ^x.ToBits() == 0
232 }
233
234
235
236
237 func (x Mask32x16) Any() bool {
238 return x.ToBits() != 0
239 }
240
241
242
243
244 func (x Mask32x16) None() bool {
245 return x.ToBits() == 0
246 }
247
248
249
250
251 func (x Mask64x8) All() bool {
252 return ^x.ToBits() == 0
253 }
254
255
256
257
258 func (x Mask64x8) Any() bool {
259 return x.ToBits() != 0
260 }
261
262
263
264
265 func (x Mask64x8) None() bool {
266 return x.ToBits() == 0
267 }
268
269
270
271
272 func (x Mask8x16) TrailingZeros() int {
273 word := uint64(x.ToBits())
274 lane := bits.TrailingZeros64(word)
275 if lane >= 16 {
276 return 16
277 }
278 return lane
279 }
280
281
282
283
284 func (x Mask8x32) TrailingZeros() int {
285 word := uint64(x.ToBits())
286 lane := bits.TrailingZeros64(word)
287 if lane >= 32 {
288 return 32
289 }
290 return lane
291 }
292
293
294
295
296 func (x Mask8x64) TrailingZeros() int {
297 word := uint64(x.ToBits())
298 lane := bits.TrailingZeros64(word)
299 if lane >= 64 {
300 return 64
301 }
302 return lane
303 }
304
305
306
307
308 func (x Mask16x8) TrailingZeros() int {
309 word := uint64(x.ToInt16x8().AsInt8x16().asMask().ToBits() & 0x5555)
310 lane := bits.TrailingZeros64(word) >> 1
311 if lane >= 8 {
312 return 8
313 }
314 return lane
315 }
316
317
318
319
320 func (x Mask16x16) TrailingZeros() int {
321 word := uint64(x.ToInt16x16().AsInt8x32().asMask().ToBits() & 0x55555555)
322 lane := bits.TrailingZeros64(word) >> 1
323 if lane >= 16 {
324 return 16
325 }
326 return lane
327 }
328
329
330
331
332 func (x Mask16x32) TrailingZeros() int {
333 word := uint64(x.ToBits())
334 lane := bits.TrailingZeros64(word)
335 if lane >= 32 {
336 return 32
337 }
338 return lane
339 }
340
341
342
343
344 func (x Mask32x4) TrailingZeros() int {
345 word := uint64(x.ToBits())
346 lane := bits.TrailingZeros64(word)
347 if lane >= 4 {
348 return 4
349 }
350 return lane
351 }
352
353
354
355
356 func (x Mask32x8) TrailingZeros() int {
357 word := uint64(x.ToBits())
358 lane := bits.TrailingZeros64(word)
359 if lane >= 8 {
360 return 8
361 }
362 return lane
363 }
364
365
366
367
368 func (x Mask32x16) TrailingZeros() int {
369 word := uint64(x.ToBits())
370 lane := bits.TrailingZeros64(word)
371 if lane >= 16 {
372 return 16
373 }
374 return lane
375 }
376
377
378
379
380 func (x Mask64x2) TrailingZeros() int {
381 word := uint64(x.ToBits())
382 lane := bits.TrailingZeros64(word)
383 if lane >= 2 {
384 return 2
385 }
386 return lane
387 }
388
389
390
391
392 func (x Mask64x4) TrailingZeros() int {
393 word := uint64(x.ToBits())
394 lane := bits.TrailingZeros64(word)
395 if lane >= 4 {
396 return 4
397 }
398 return lane
399 }
400
401
402
403
404 func (x Mask64x8) TrailingZeros() int {
405 word := uint64(x.ToBits())
406 lane := bits.TrailingZeros64(word)
407 if lane >= 8 {
408 return 8
409 }
410 return lane
411 }
412
View as plain text