T-SIMD v31.1.0
A C++ template SIMD library
Loading...
Searching...
No Matches
base_impl_sandbox.H
1// ===========================================================================
2//
3// test template functions for Vec and base level ("level-0") function
4// templates these functions just print out template parameters and some
5// arguments
6//
7// This source code file is part of the following software:
8//
9// - the low-level C++ template SIMD library
10// - the SIMD implementation of the MinWarping and the 2D-Warping methods
11// for local visual homing.
12//
13// The software is provided based on the accompanying license agreement in the
14// file LICENSE.md.
15// The software is provided "as is" without any warranty by the licensor and
16// without any liability of the licensor, and the software may not be
17// distributed by the licensee; see the license agreement for details.
18//
19// (C) Ralf Möller
20// Computer Engineering
21// Faculty of Technology
22// Bielefeld University
23// www.ti.uni-bielefeld.de
24//
25// ===========================================================================
26
27// 22. Jan 23 (Jonas Keller): moved sandbox implementations into internal
28// namespace
29
30#pragma once
31#ifndef SIMD_VEC_BASE_IMPL_SANDBOX_H_
32#define SIMD_VEC_BASE_IMPL_SANDBOX_H_
33
34// TODO: should this only contain level 0 functions?
35
36#include "../alloc.H"
37#include "../defs.H"
38#include "../types.H"
39#include "../vec.H"
40
41#include <cstdint>
42#include <cstdio>
43
44#ifdef SIMDVEC_SANDBOX
45
46namespace simd {
47
48// ===========================================================================
49// generic template for Vec
50// ===========================================================================
51
52template <typename T, size_t SIMD_WIDTH>
53class Vec
54{
55public:
56 using Type = T;
57 static constexpr size_t elements = SIMD_WIDTH / sizeof(T);
58 static constexpr size_t elems = elements;
59 static constexpr size_t bytes = SIMD_WIDTH;
60 Vec() {}
61 // 05. Sep 23 (Jonas Keller): added allocator
62 using allocator = aligned_allocator<Vec<T, bytes>, bytes>;
63};
64
65namespace internal {
66namespace base {
67
68// ===========================================================================
69// reinterpretation cast
70// ===========================================================================
71
72template <typename Tdst, typename Tsrc, size_t SIMD_WIDTH>
73static SIMD_INLINE Vec<Tdst, SIMD_WIDTH> reinterpret(
74 const Vec<Tsrc, SIMD_WIDTH> &, OutputType<Tdst>)
75{
76 printf("reinterpret<%s,%s,%zu>(V)\n", TypeInfo<Tdst>::name(),
77 TypeInfo<Tsrc>::name(), SIMD_WIDTH);
78 return Vec<Tdst, SIMD_WIDTH>();
79}
80
81// ===========================================================================
82// generic functions on Vec
83// ===========================================================================
84
85template <typename T, size_t SIMD_WIDTH>
86static SIMD_INLINE Vec<T, SIMD_WIDTH> setzero(OutputType<T>,
87 Integer<SIMD_WIDTH>)
88{
89 printf("setzero<%s,%zu>()\n", TypeInfo<T>::name(), SIMD_WIDTH);
90 return Vec<T, SIMD_WIDTH>();
91}
92
93template <typename T, size_t SIMD_WIDTH>
94static SIMD_INLINE Vec<T, SIMD_WIDTH> set1(T, Integer<SIMD_WIDTH>)
95{
96 printf("set1<%s,%zu>()\n", TypeInfo<T>::name(), SIMD_WIDTH);
97 return Vec<T, SIMD_WIDTH>();
98}
99
100// template argument order reversed so that T can be omitted in instantiation
101template <size_t SIMD_WIDTH, typename T>
102static SIMD_INLINE Vec<T, SIMD_WIDTH> load(const T *const p,
103 Integer<SIMD_WIDTH>)
104{
105 printf("load<%zu,%s>(%p)\n", SIMD_WIDTH, TypeInfo<T>::name(), (void *) p);
106 return Vec<T, SIMD_WIDTH>();
107}
108
109// template argument order reversed so that T can be omitted in instantiation
110template <size_t SIMD_WIDTH, typename T>
111static SIMD_INLINE Vec<T, SIMD_WIDTH> loadu(const T *const p,
112 Integer<SIMD_WIDTH>)
113{
114 printf("loadu<%zu,%s>(%p)\n", SIMD_WIDTH, TypeInfo<T>::name(), (void *) p);
115 return Vec<T, SIMD_WIDTH>();
116}
117
118template <typename T, size_t SIMD_WIDTH>
119static SIMD_INLINE void store(T *const p, const Vec<T, SIMD_WIDTH> &)
120{
121 printf("store<%s,%zu>(%p,V)\n", TypeInfo<T>::name(), SIMD_WIDTH, (void *) p);
122}
123
124template <typename T, size_t SIMD_WIDTH>
125static SIMD_INLINE void storeu(T *const p, const Vec<T, SIMD_WIDTH> &)
126{
127 printf("storeu<%s,%zu>(%p,V)\n", TypeInfo<T>::name(), SIMD_WIDTH, (void *) p);
128}
129
130template <typename T, size_t SIMD_WIDTH>
131static SIMD_INLINE void stream_store(T *const p, const Vec<T, SIMD_WIDTH> &)
132{
133 printf("stream_store<%s,%zu>(%p,V)\n", TypeInfo<T>::name(), SIMD_WIDTH,
134 (void *) p);
135}
136
137static SIMD_INLINE void lfence()
138{
139 printf("lfence\n");
140}
141
142static SIMD_INLINE void sfence()
143{
144 printf("sfence\n");
145}
146
147static SIMD_INLINE void mfence()
148{
149 printf("mfence\n");
150}
151
152template <size_t INDEX, typename T, size_t SIMD_WIDTH>
153static SIMD_INLINE T extract(const Vec<T, SIMD_WIDTH> &)
154{
155 printf("extract<%zu,%s,%zu>(V)\n", INDEX, TypeInfo<T>::name(), SIMD_WIDTH);
156 return T(0);
157}
158
159template <typename T, size_t SIMD_WIDTH>
160static SIMD_INLINE Vec<T, SIMD_WIDTH> add(const Vec<T, SIMD_WIDTH> &,
161 const Vec<T, SIMD_WIDTH> &)
162{
163 printf("add<%s,%zu>(V,V)\n", TypeInfo<T>::name(), SIMD_WIDTH);
164 return Vec<T, SIMD_WIDTH>();
165}
166
167template <typename T, size_t SIMD_WIDTH>
168static SIMD_INLINE Vec<T, SIMD_WIDTH> adds(const Vec<T, SIMD_WIDTH> &,
169 const Vec<T, SIMD_WIDTH> &)
170{
171 printf("adds<%s,%zu>(V,V)\n", TypeInfo<T>::name(), SIMD_WIDTH);
172 return Vec<T, SIMD_WIDTH>();
173}
174
175template <typename T, size_t SIMD_WIDTH>
176static SIMD_INLINE Vec<T, SIMD_WIDTH> sub(const Vec<T, SIMD_WIDTH> &,
177 const Vec<T, SIMD_WIDTH> &)
178{
179 printf("sub<%s,%zu>(V,V)\n", TypeInfo<T>::name(), SIMD_WIDTH);
180 return Vec<T, SIMD_WIDTH>();
181}
182
183template <typename T, size_t SIMD_WIDTH>
184static SIMD_INLINE Vec<T, SIMD_WIDTH> subs(const Vec<T, SIMD_WIDTH> &,
185 const Vec<T, SIMD_WIDTH> &)
186{
187 printf("subs<%s,%zu>(V,V)\n", TypeInfo<T>::name(), SIMD_WIDTH);
188 return Vec<T, SIMD_WIDTH>();
189}
190
191template <typename T, size_t SIMD_WIDTH>
192static SIMD_INLINE Vec<T, SIMD_WIDTH> neg(const Vec<T, SIMD_WIDTH> &)
193{
194 printf("neg<%s,%zu>(V)\n", TypeInfo<T>::name(), SIMD_WIDTH);
195 return Vec<T, SIMD_WIDTH>();
196}
197
198template <typename T, size_t SIMD_WIDTH>
199static SIMD_INLINE Vec<T, SIMD_WIDTH> mul(const Vec<T, SIMD_WIDTH> &,
200 const Vec<T, SIMD_WIDTH> &)
201{
202 printf("mul<%s,%zu>(V,V)\n", TypeInfo<T>::name(), SIMD_WIDTH);
203 return Vec<T, SIMD_WIDTH>();
204}
205
206template <typename T, size_t SIMD_WIDTH>
207static SIMD_INLINE Vec<T, SIMD_WIDTH> div(const Vec<T, SIMD_WIDTH> &,
208 const Vec<T, SIMD_WIDTH> &)
209{
210 printf("div<%s,%zu>(V,V)\n", TypeInfo<T>::name(), SIMD_WIDTH);
211 return Vec<T, SIMD_WIDTH>();
212}
213
214template <typename T, size_t SIMD_WIDTH>
215static SIMD_INLINE Vec<T, SIMD_WIDTH> ceil(const Vec<T, SIMD_WIDTH> &)
216{
217 printf("ceil<%s,%zu>(V)\n", TypeInfo<T>::name(), SIMD_WIDTH);
218 return Vec<T, SIMD_WIDTH>();
219}
220
221template <typename T, size_t SIMD_WIDTH>
222static SIMD_INLINE Vec<T, SIMD_WIDTH> floor(const Vec<T, SIMD_WIDTH> &)
223{
224 printf("floor<%s,%zu>(V)\n", TypeInfo<T>::name(), SIMD_WIDTH);
225 return Vec<T, SIMD_WIDTH>();
226}
227
228template <typename T, size_t SIMD_WIDTH>
229static SIMD_INLINE Vec<T, SIMD_WIDTH> round(const Vec<T, SIMD_WIDTH> &)
230{
231 printf("round<%s,%zu>(V,V)\n", TypeInfo<T>::name(), SIMD_WIDTH);
232 return Vec<T, SIMD_WIDTH>();
233}
234
235template <typename T, size_t SIMD_WIDTH>
236static SIMD_INLINE Vec<T, SIMD_WIDTH> truncate(const Vec<T, SIMD_WIDTH> &)
237{
238 printf("truncate<%s,%zu>(V,V)\n", TypeInfo<T>::name(), SIMD_WIDTH);
239 return Vec<T, SIMD_WIDTH>();
240}
241
242template <typename T, size_t SIMD_WIDTH>
243static SIMD_INLINE Vec<T, SIMD_WIDTH> rcp(const Vec<T, SIMD_WIDTH> &)
244{
245 printf("rcp<%s,%zu>(V,V)\n", TypeInfo<T>::name(), SIMD_WIDTH);
246 return Vec<T, SIMD_WIDTH>();
247}
248
249template <typename T, size_t SIMD_WIDTH>
250static SIMD_INLINE Vec<T, SIMD_WIDTH> rsqrt(const Vec<T, SIMD_WIDTH> &)
251{
252 printf("rsqrt<%s,%zu>(V,V)\n", TypeInfo<T>::name(), SIMD_WIDTH);
253 return Vec<T, SIMD_WIDTH>();
254}
255
256template <typename T, size_t SIMD_WIDTH>
257static SIMD_INLINE Vec<T, SIMD_WIDTH> sqrt(const Vec<T, SIMD_WIDTH> &)
258{
259 printf("sqrt<%s,%zu>(V,V)\n", TypeInfo<T>::name(), SIMD_WIDTH);
260 return Vec<T, SIMD_WIDTH>();
261}
262
263template <typename T, size_t SIMD_WIDTH>
264static SIMD_INLINE Vec<T, SIMD_WIDTH> min(const Vec<T, SIMD_WIDTH> &,
265 const Vec<T, SIMD_WIDTH> &)
266{
267 printf("min<%s,%zu>(V,V)\n", TypeInfo<T>::name(), SIMD_WIDTH);
268 return Vec<T, SIMD_WIDTH>();
269}
270
271template <typename T, size_t SIMD_WIDTH>
272static SIMD_INLINE Vec<T, SIMD_WIDTH> max(const Vec<T, SIMD_WIDTH> &,
273 const Vec<T, SIMD_WIDTH> &)
274{
275 printf("max<%s,%zu>(V,V)\n", TypeInfo<T>::name(), SIMD_WIDTH);
276 return Vec<T, SIMD_WIDTH>();
277}
278
279template <typename T, size_t SIMD_WIDTH>
280static SIMD_INLINE Vec<T, SIMD_WIDTH> abs(const Vec<T, SIMD_WIDTH> &)
281{
282 printf("abs<%s,%zu>(V)\n", TypeInfo<T>::name(), SIMD_WIDTH);
283 return Vec<T, SIMD_WIDTH>();
284}
285
286// unpack NUM_ELEMS elements of type T
287// PART=0: low half of input vectors,
288// PART=1: high half of input vectors
289template <size_t PART, size_t BYTES, typename T, size_t SIMD_WIDTH>
290static SIMD_INLINE Vec<T, SIMD_WIDTH> unpack(const Vec<T, SIMD_WIDTH> &,
291 const Vec<T, SIMD_WIDTH> &,
292 Part<PART>, Bytes<BYTES>)
293{
294 printf("unpack<PART=%zu,BYTES=%zu,%s,%zu>(V,V)\n", PART, BYTES,
295 TypeInfo<T>::name(), SIMD_WIDTH);
296 return Vec<T, SIMD_WIDTH>();
297}
298
299// unpack16
300template <size_t PART, size_t BYTES, typename T, size_t SIMD_WIDTH>
301static SIMD_INLINE Vec<T, SIMD_WIDTH> unpack16(const Vec<T, SIMD_WIDTH> &,
302 const Vec<T, SIMD_WIDTH> &,
303 Part<PART>, Bytes<BYTES>)
304{
305 printf("unpack16<PART=%zu,BYTES=%zu,%s,%zu>(V,V)\n", PART, BYTES,
306 TypeInfo<T>::name(), SIMD_WIDTH);
307 return Vec<T, SIMD_WIDTH>();
308}
309
310// extractLane
311template <size_t LANE_INDEX, typename T, size_t SIMD_WIDTH>
312static SIMD_INLINE Vec<T, 16> extractLane(const Vec<T, SIMD_WIDTH> &)
313{
314 printf("extractLane<IMM=%zu,%s,%zu>(V)\n", LANE_INDEX, TypeInfo<T>::name(),
315 SIMD_WIDTH);
316 return Vec<T, 16>();
317}
318
319// zip (2 x unpack) NUM_ELEMS elements of type T
320template <size_t NUM_ELEMS, typename T, size_t SIMD_WIDTH>
321static SIMD_INLINE void zip(const Vec<T, SIMD_WIDTH>, const Vec<T, SIMD_WIDTH>,
322 Vec<T, SIMD_WIDTH> &, Vec<T, SIMD_WIDTH> &)
323{
324 printf("zip<NUM_ELEMS=%zu,%s,%zu>(V,V,V&,V&)\n", NUM_ELEMS,
325 TypeInfo<T>::name(), SIMD_WIDTH);
326}
327
328// zip16
329template <size_t NUM_ELEMS, typename T, size_t SIMD_WIDTH>
330static SIMD_INLINE void zip16(const Vec<T, SIMD_WIDTH>,
331 const Vec<T, SIMD_WIDTH>, Vec<T, SIMD_WIDTH> &,
332 Vec<T, SIMD_WIDTH> &)
333{
334 printf("zip16<NUM_ELEMS=%zu,%s,%zu>(V,V,V&,V&)\n", NUM_ELEMS,
335 TypeInfo<T>::name(), SIMD_WIDTH);
336}
337
338// unzip (inverse of zip)
339template <size_t BYTES, typename T, size_t SIMD_WIDTH>
340static SIMD_INLINE void unzip(const Vec<T, SIMD_WIDTH>,
341 const Vec<T, SIMD_WIDTH>, Vec<T, SIMD_WIDTH> &,
342 Vec<T, SIMD_WIDTH> &, Bytes<BYTES>)
343{
344 printf("unzip<BYTES=%zu,%s,%zu>(V,V,V&,V&)\n", BYTES, TypeInfo<T>::name(),
345 SIMD_WIDTH);
346}
347
348// unifies packs and packus, depending on Tout
349template <typename Tout, typename Tin, size_t SIMD_WIDTH>
350static SIMD_INLINE Vec<Tout, SIMD_WIDTH> packs(const Vec<Tin, SIMD_WIDTH> &,
351 const Vec<Tin, SIMD_WIDTH> &,
352 OutputType<Tout>)
353{
354 printf("packs<%s,%s,%zu>(V,V)\n", TypeInfo<Tout>::name(),
355 TypeInfo<Tin>::name(), SIMD_WIDTH);
356 return Vec<Tout, SIMD_WIDTH>();
357}
358
359// generalized version of unpack-based type conversion: includes
360// multistage extension (zero-extend or sign-extend, depending on
361// type)
362template <typename Tout, typename Tin, size_t SIMD_WIDTH>
363static SIMD_INLINE void extend(
364 const Vec<Tin, SIMD_WIDTH> &,
365 Vec<Tout, SIMD_WIDTH>[sizeof(Tout) / sizeof(Tin)])
366{
367 printf("extend<%s,%s,%zu>>(V,V*)\n", TypeInfo<Tout>::name(),
368 TypeInfo<Tin>::name(), SIMD_WIDTH);
369}
370
371template <size_t COUNT, typename T, size_t SIMD_WIDTH>
372static SIMD_INLINE Vec<T, SIMD_WIDTH> srai(const Vec<T, SIMD_WIDTH> &)
373{
374 printf("srai<%zu,%s,%zu>(V)\n", COUNT, TypeInfo<T>::name(), SIMD_WIDTH);
375 return Vec<T, SIMD_WIDTH>();
376}
377
378template <size_t COUNT, typename T, size_t SIMD_WIDTH>
379static SIMD_INLINE Vec<T, SIMD_WIDTH> srli(const Vec<T, SIMD_WIDTH> &)
380{
381 printf("srli<%zu,%s,%zu>(V)\n", COUNT, TypeInfo<T>::name(), SIMD_WIDTH);
382 return Vec<T, SIMD_WIDTH>();
383}
384
385template <size_t COUNT, typename T, size_t SIMD_WIDTH>
386static SIMD_INLINE Vec<T, SIMD_WIDTH> slli(const Vec<T, SIMD_WIDTH> &)
387{
388 printf("slli<%zu,%s,%zu>(V)\n", COUNT, TypeInfo<T>::name(), SIMD_WIDTH);
389 return Vec<T, SIMD_WIDTH>();
390}
391
392// 12. Jan 23 (Jonas Keller): added sra, srl and sll functions
393
394template <typename T, size_t SIMD_WIDTH>
395static SIMD_INLINE Vec<T, SIMD_WIDTH> sra(const Vec<T, SIMD_WIDTH> &,
396 const uint8_t)
397{
398 printf("sra<%s,%zu>(V, U8)\n", TypeInfo<T>::name(), SIMD_WIDTH);
399 return Vec<T, SIMD_WIDTH>();
400}
401
402template <typename T, size_t SIMD_WIDTH>
403static SIMD_INLINE Vec<T, SIMD_WIDTH> srl(const Vec<T, SIMD_WIDTH> &,
404 const uint8_t)
405{
406 printf("srl<%s,%zu>(V, U8)\n", TypeInfo<T>::name(), SIMD_WIDTH);
407 return Vec<T, SIMD_WIDTH>();
408}
409
410template <typename T, size_t SIMD_WIDTH>
411static SIMD_INLINE Vec<T, SIMD_WIDTH> sll(const Vec<T, SIMD_WIDTH> &,
412 const uint8_t)
413{
414 printf("sll<%s,%zu>(V, U8)\n", TypeInfo<T>::name(), SIMD_WIDTH);
415 return Vec<T, SIMD_WIDTH>();
416}
417
418// conversion without changes in the number of vector elements
419// saturated version
420template <typename Tout, typename Tin, size_t SIMD_WIDTH>
421static SIMD_INLINE Vec<Tout, SIMD_WIDTH> cvts(const Vec<Tin, SIMD_WIDTH> &,
422 OutputType<Tout>)
423{
424 printf("cvts<%s,%s,%zu>(V)\n", TypeInfo<Tout>::name(), TypeInfo<Tin>::name(),
425 SIMD_WIDTH);
426 return Vec<Tout, SIMD_WIDTH>();
427}
428
429// horizontal addition
430template <typename T, size_t SIMD_WIDTH>
431static SIMD_INLINE Vec<T, SIMD_WIDTH> hadd(const Vec<T, SIMD_WIDTH> &,
432 const Vec<T, SIMD_WIDTH> &)
433{
434 printf("hadd<%s,%zu>(V,V)\n", TypeInfo<T>::name(), SIMD_WIDTH);
435 return Vec<T, SIMD_WIDTH>();
436}
437
438// horizontal addition (with saturation)
439template <typename T, size_t SIMD_WIDTH>
440static SIMD_INLINE Vec<T, SIMD_WIDTH> hadds(const Vec<T, SIMD_WIDTH> &,
441 const Vec<T, SIMD_WIDTH> &)
442{
443 printf("hadds<%s,%zu>(V,V)\n", TypeInfo<T>::name(), SIMD_WIDTH);
444 return Vec<T, SIMD_WIDTH>();
445}
446
447// horizontal subtraction
448template <typename T, size_t SIMD_WIDTH>
449static SIMD_INLINE Vec<T, SIMD_WIDTH> hsub(const Vec<T, SIMD_WIDTH> &,
450 const Vec<T, SIMD_WIDTH> &)
451{
452 printf("hsub<%s,%zu>(V,V)\n", TypeInfo<T>::name(), SIMD_WIDTH);
453 return Vec<T, SIMD_WIDTH>();
454}
455
456// horizontal subtraction (with saturation)
457template <typename T, size_t SIMD_WIDTH>
458static SIMD_INLINE Vec<T, SIMD_WIDTH> hsubs(const Vec<T, SIMD_WIDTH> &,
459 const Vec<T, SIMD_WIDTH> &)
460{
461 printf("hsubs<%s,%zu>(V,V)\n", TypeInfo<T>::name(), SIMD_WIDTH);
462 return Vec<T, SIMD_WIDTH>();
463}
464
465// logical right shift by n elements, filling in zeros
466template <size_t COUNT, typename T, size_t SIMD_WIDTH>
467static SIMD_INLINE Vec<T, SIMD_WIDTH> srle(const Vec<T, SIMD_WIDTH> &)
468{
469 printf("srle<%zu,%s,%zu>(V)\n", COUNT, TypeInfo<T>::name(), SIMD_WIDTH);
470 return Vec<T, SIMD_WIDTH>();
471}
472
473// logical left shift by n elements, filling in zeros
474template <size_t COUNT, typename T, size_t SIMD_WIDTH>
475static SIMD_INLINE Vec<T, SIMD_WIDTH> slle(const Vec<T, SIMD_WIDTH> &)
476{
477 printf("slle<%zu,%s,%zu>(V)\n", COUNT, TypeInfo<T>::name(), SIMD_WIDTH);
478 return Vec<T, SIMD_WIDTH>();
479}
480
481// alignr (with number of elements in imm):
482template <size_t COUNT, typename T, size_t SIMD_WIDTH>
483static SIMD_INLINE Vec<T, SIMD_WIDTH> alignre(const Vec<T, SIMD_WIDTH> &,
484 const Vec<T, SIMD_WIDTH> &)
485{
486 printf("alignre<%zu,%s,%zu>(V,V)\n", COUNT, TypeInfo<T>::name(), SIMD_WIDTH);
487 return Vec<T, SIMD_WIDTH>();
488}
489
490// swizzle (AoS to SoA), in-place, with template parameter N
491template <size_t N, typename T, size_t SIMD_WIDTH>
492static SIMD_INLINE void swizzle(Vec<T, SIMD_WIDTH>[N], Integer<N>)
493{
494 printf("swizzle<%zu,%s,%zu>(V,V*)\n", N, TypeInfo<T>::name(), SIMD_WIDTH);
495}
496
497// ifelse
498template <typename T, size_t SIMD_WIDTH>
499static SIMD_INLINE Vec<T, SIMD_WIDTH> ifelse(const Vec<T, SIMD_WIDTH> &,
500 const Vec<T, SIMD_WIDTH> &,
501 const Vec<T, SIMD_WIDTH> &)
502{
503 printf("ifelse<%s,%zu>(V,V,V)\n", TypeInfo<T>::name(), SIMD_WIDTH);
504 return Vec<T, SIMD_WIDTH>();
505}
506
507// compare <
508template <typename T, size_t SIMD_WIDTH>
509static SIMD_INLINE Vec<T, SIMD_WIDTH> cmplt(const Vec<T, SIMD_WIDTH> &,
510 const Vec<T, SIMD_WIDTH> &)
511{
512 printf("cmplt<%s,%zu>(V,V)\n", TypeInfo<T>::name(), SIMD_WIDTH);
513 return Vec<T, SIMD_WIDTH>();
514}
515
516// compare <=
517template <typename T, size_t SIMD_WIDTH>
518static SIMD_INLINE Vec<T, SIMD_WIDTH> cmple(const Vec<T, SIMD_WIDTH> &,
519 const Vec<T, SIMD_WIDTH> &)
520{
521 printf("cmple<%s,%zu>(V,V)\n", TypeInfo<T>::name(), SIMD_WIDTH);
522 return Vec<T, SIMD_WIDTH>();
523}
524
525// compare ==
526template <typename T, size_t SIMD_WIDTH>
527static SIMD_INLINE Vec<T, SIMD_WIDTH> cmpeq(const Vec<T, SIMD_WIDTH> &,
528 const Vec<T, SIMD_WIDTH> &)
529{
530 printf("cmpeq<%s,%zu>(V,V)\n", TypeInfo<T>::name(), SIMD_WIDTH);
531 return Vec<T, SIMD_WIDTH>();
532}
533
534// compare >=
535template <typename T, size_t SIMD_WIDTH>
536static SIMD_INLINE Vec<T, SIMD_WIDTH> cmpge(const Vec<T, SIMD_WIDTH> &,
537 const Vec<T, SIMD_WIDTH> &)
538{
539 printf("cmpge<%s,%zu>(V,V)\n", TypeInfo<T>::name(), SIMD_WIDTH);
540 return Vec<T, SIMD_WIDTH>();
541}
542
543// compare >
544template <typename T, size_t SIMD_WIDTH>
545static SIMD_INLINE Vec<T, SIMD_WIDTH> cmpgt(const Vec<T, SIMD_WIDTH> &,
546 const Vec<T, SIMD_WIDTH> &)
547{
548 printf("cmpgt<%s,%zu>(V,V)\n", TypeInfo<T>::name(), SIMD_WIDTH);
549 return Vec<T, SIMD_WIDTH>();
550}
551
552// compare !=
553template <typename T, size_t SIMD_WIDTH>
554static SIMD_INLINE Vec<T, SIMD_WIDTH> cmpneq(const Vec<T, SIMD_WIDTH> &,
555 const Vec<T, SIMD_WIDTH> &)
556{
557 printf("cmpneq<%s,%zu>(V,V)\n", TypeInfo<T>::name(), SIMD_WIDTH);
558 return Vec<T, SIMD_WIDTH>();
559}
560
561// bitwise and
562template <typename T, size_t SIMD_WIDTH>
563static SIMD_INLINE Vec<T, SIMD_WIDTH> bit_and(const Vec<T, SIMD_WIDTH> &,
564 const Vec<T, SIMD_WIDTH> &)
565{
566 printf("and<%s,%zu>(V,V)\n", TypeInfo<T>::name(), SIMD_WIDTH);
567 return Vec<T, SIMD_WIDTH>();
568}
569
570// bitwise or
571template <typename T, size_t SIMD_WIDTH>
572static SIMD_INLINE Vec<T, SIMD_WIDTH> bit_or(const Vec<T, SIMD_WIDTH> &,
573 const Vec<T, SIMD_WIDTH> &)
574{
575 printf("or<%s,%zu>(V,V)\n", TypeInfo<T>::name(), SIMD_WIDTH);
576 return Vec<T, SIMD_WIDTH>();
577}
578
579// bitwise andnot: (not a) and b
580template <typename T, size_t SIMD_WIDTH>
581static SIMD_INLINE Vec<T, SIMD_WIDTH> bit_andnot(const Vec<T, SIMD_WIDTH> &,
582 const Vec<T, SIMD_WIDTH> &)
583{
584 printf("bit_andnot<%s,%zu>(V,V)\n", TypeInfo<T>::name(), SIMD_WIDTH);
585 return Vec<T, SIMD_WIDTH>();
586}
587
588// bitwise xor
589template <typename T, size_t SIMD_WIDTH>
590static SIMD_INLINE Vec<T, SIMD_WIDTH> bit_xor(const Vec<T, SIMD_WIDTH> &,
591 const Vec<T, SIMD_WIDTH> &)
592{
593 printf("xor<%s,%zu>(V,V)\n", TypeInfo<T>::name(), SIMD_WIDTH);
594 return Vec<T, SIMD_WIDTH>();
595}
596
597// bitwise not (work-arounds required)
598template <typename T, size_t SIMD_WIDTH>
599static SIMD_INLINE Vec<T, SIMD_WIDTH> bit_not(const Vec<T, SIMD_WIDTH> &)
600{
601 printf("not<%s,%zu>(V)\n", TypeInfo<T>::name(), SIMD_WIDTH);
602 return Vec<T, SIMD_WIDTH>();
603}
604
605template <typename T, size_t SIMD_WIDTH>
606static SIMD_INLINE Vec<T, SIMD_WIDTH> avg(const Vec<T, SIMD_WIDTH> &,
607 const Vec<T, SIMD_WIDTH> &)
608{
609 printf("avg<%s,%zu>(V,V)\n", TypeInfo<T>::name(), SIMD_WIDTH);
610 return Vec<T, SIMD_WIDTH>();
611}
612
613// test if all bits are zeros (false)
614template <typename T, size_t SIMD_WIDTH>
615static SIMD_INLINE bool test_all_zeros(const Vec<T, SIMD_WIDTH> &)
616{
617 printf("test_all_zeros<%s,%zu>(V)\n", TypeInfo<T>::name(), SIMD_WIDTH);
618 return 0;
619}
620
621// test if all bits are ones (true)
622template <typename T, size_t SIMD_WIDTH>
623static SIMD_INLINE bool test_all_ones(const Vec<T, SIMD_WIDTH> &)
624{
625 printf("test_all_ones<%s,%zu>(V)\n", TypeInfo<T>::name(), SIMD_WIDTH);
626 return 0;
627}
628
629// TODO: not level 0, should this be in the sandbox?
630// negate a, where b is negative, Float only
631template <typename T, size_t SIMD_WIDTH>
632static SIMD_INLINE Vec<T, SIMD_WIDTH> sign(const Vec<T, SIMD_WIDTH> &,
633 const Vec<T, SIMD_WIDTH> &)
634{
635 printf("sign<%s,%zu>(V,V)\n", TypeInfo<T>::name(), SIMD_WIDTH);
636 return Vec<T, SIMD_WIDTH>();
637}
638
639// TODO: not level 0, should this be in the sandbox?
640// Computes elementwise absolute difference of vectors
641template <typename T, size_t SIMD_WIDTH>
642static SIMD_INLINE Vec<T, SIMD_WIDTH> absDiff(const Vec<T, SIMD_WIDTH> &,
643 const Vec<T, SIMD_WIDTH> &)
644{
645 printf("absDiff<%s,%zu>(V,V)\n", TypeInfo<T>::name(), SIMD_WIDTH);
646 return Vec<T, SIMD_WIDTH>();
647}
648
649// reverse order
650template <typename T, size_t SIMD_WIDTH>
651static Vec<T, SIMD_WIDTH> reverse(const Vec<T, SIMD_WIDTH> &)
652{
653 printf("reverse<%s,%zu>(V)\n", TypeInfo<T>::name(), SIMD_WIDTH);
654 return Vec<T, SIMD_WIDTH>();
655}
656
657// 27. Aug 22 (Jonas Keller): added msb2int
658template <typename T, size_t SIMD_WIDTH>
659static SIMD_INLINE uint64_t msb2int(const Vec<T, SIMD_WIDTH> &)
660{
661 printf("msb2int<%s,%zu>(V)\n", TypeInfo<T>::name(), SIMD_WIDTH);
662 return 0;
663}
664
665// 09. Oct 22 (Jonas Keller): added int2msb
666template <typename T, size_t SIMD_WIDTH>
667static SIMD_INLINE Vec<T, SIMD_WIDTH> int2msb(const uint64_t, OutputType<T>,
668 Integer<SIMD_WIDTH>)
669{
670 printf("int2msb<%s,%zu>(U64)\n", TypeInfo<T>::name(), SIMD_WIDTH);
671 return Vec<T, SIMD_WIDTH>();
672}
673
674// 09. Oct 22 (Jonas Keller): added int2bits
675template <typename T, size_t SIMD_WIDTH>
676static SIMD_INLINE Vec<T, SIMD_WIDTH> int2bits(const uint64_t, OutputType<T>,
677 Integer<SIMD_WIDTH>)
678{
679 printf("int2bits<%s,%zu>(U64)\n", TypeInfo<T>::name(), SIMD_WIDTH);
680 return Vec<T, SIMD_WIDTH>();
681}
682
683// 30. Jan 23 (Jonas Keller): added iota
684
685template <typename T, size_t SIMD_WIDTH>
686static SIMD_INLINE Vec<T, SIMD_WIDTH> iota(OutputType<T>, Integer<SIMD_WIDTH>)
687{
688 printf("iota<%s,%zu>()\n", TypeInfo<T>::name(), SIMD_WIDTH);
689 return Vec<T, SIMD_WIDTH>();
690}
691} // namespace base
692} // namespace internal
693} // namespace simd
694
695#endif // SIMDVEC_SANDBOX
696
697#endif // SIMD_VEC_BASE_IMPL_SANDBOX_H_
aligned_allocator< Vec< T, SIMD_WIDTH >, SIMD_WIDTH > allocator
Allocator to be used with std::vector.
Definition vec.H:103
static constexpr size_t elems
Number of elements in the vector. Alias for elements.
Definition vec.H:85
static constexpr size_t bytes
Number of bytes in the vector.
Definition vec.H:90
static constexpr size_t elements
Number of elements in the vector.
Definition vec.H:80
Namespace for T-SIMD.
Definition time_measurement.H:161