Argon 0.1.0
Loading...
Searching...
No Matches
multivector.hpp
1#pragma once
2#include <cstddef>
3#include "argon/features.h"
4
5#ifdef __ARM_NEON
6#include <arm_neon.h>
7#define simd neon
8#elifdef __ARM_FEATURE_MVE
9#include <arm_mve.h>
10#define simd mve
11#else
13#define simd neon
14#endif
15
16namespace simd {
17
21template <typename T, size_t size>
23
24// clang-format off
26template <> struct MultiVector<int8x16_t, 2> { using type = int8x16x2_t; };
27template <> struct MultiVector<uint8x16_t, 2> { using type = uint8x16x2_t; };
28template <> struct MultiVector<int16x8_t, 2> { using type = int16x8x2_t; };
29template <> struct MultiVector<uint16x8_t, 2> { using type = uint16x8x2_t; };
30template <> struct MultiVector<int32x4_t, 2> { using type = int32x4x2_t; };
31template <> struct MultiVector<uint32x4_t, 2> { using type = uint32x4x2_t; };
32template <> struct MultiVector<int64x2_t, 2> { using type = int64x2x2_t; };
33template <> struct MultiVector<uint64x2_t, 2> { using type = uint64x2x2_t; };
34template <> struct MultiVector<float32x4_t, 2> { using type = float32x4x2_t; };
35
36#ifndef ARGON_PLATFORM_MVE
37template <> struct MultiVector<int8x16_t, 3> { using type = int8x16x3_t; };
38template <> struct MultiVector<uint8x16_t, 3> { using type = uint8x16x3_t; };
39template <> struct MultiVector<int16x8_t, 3> { using type = int16x8x3_t; };
40template <> struct MultiVector<uint16x8_t, 3> { using type = uint16x8x3_t; };
41template <> struct MultiVector<int32x4_t, 3> { using type = int32x4x3_t; };
42template <> struct MultiVector<uint32x4_t, 3> { using type = uint32x4x3_t; };
43template <> struct MultiVector<int64x2_t, 3> { using type = int64x2x3_t; };
44template <> struct MultiVector<uint64x2_t, 3> { using type = uint64x2x3_t; };
45template <> struct MultiVector<float32x4_t, 3> { using type = float32x4x3_t; };
46#endif
47
48template <> struct MultiVector<int8x16_t, 4> { using type = int8x16x4_t; };
49template <> struct MultiVector<uint8x16_t, 4> { using type = uint8x16x4_t; };
50template <> struct MultiVector<int16x8_t, 4> { using type = int16x8x4_t; };
51template <> struct MultiVector<uint16x8_t, 4> { using type = uint16x8x4_t; };
52template <> struct MultiVector<int32x4_t, 4> { using type = int32x4x4_t; };
53template <> struct MultiVector<uint32x4_t, 4> { using type = uint32x4x4_t; };
54template <> struct MultiVector<int64x2_t, 4> { using type = int64x2x4_t; };
55template <> struct MultiVector<uint64x2_t, 4> { using type = uint64x2x4_t; };
56template <> struct MultiVector<float32x4_t, 4> { using type = float32x4x4_t; };
57
58#ifndef ARGON_PLATFORM_MVE
59template <> struct MultiVector<float32x2_t, 2> { using type = float32x2x2_t; };
60template <> struct MultiVector<poly8x8_t, 2> { using type = poly8x8x2_t; };
61template <> struct MultiVector<poly16x4_t, 2> { using type = poly16x4x2_t; };
62
63template <> struct MultiVector<float32x2_t, 3> { using type = float32x2x3_t; };
64template <> struct MultiVector<poly8x8_t, 3> { using type = poly8x8x3_t; };
65template <> struct MultiVector<poly16x4_t, 3> { using type = poly16x4x3_t; };
66
67template <> struct MultiVector<float32x2_t, 4> { using type = float32x2x4_t; };
68template <> struct MultiVector<poly8x8_t, 4> { using type = poly8x8x4_t; };
69template <> struct MultiVector<poly16x4_t, 4> { using type = poly16x4x4_t; };
70#endif
71
72#if ARGON_HAS_HALF_FLOAT
73template <> struct MultiVector<float16x8_t, 2> { using type = float16x8x2_t; };
74
75#ifndef ARGON_PLATFORM_MVE
76template <> struct MultiVector<float16x8_t, 3> { using type = float16x8x3_t; };
77#endif
78
79template <> struct MultiVector<float16x8_t, 4> { using type = float16x8x4_t; };
80#endif
81
82
83#ifndef ARGON_PLATFORM_MVE
84template <> struct MultiVector<int8x8_t, 2> { using type = int8x8x2_t; };
85template <> struct MultiVector<uint8x8_t, 2> { using type = uint8x8x2_t; };
86template <> struct MultiVector<int16x4_t, 2> { using type = int16x4x2_t; };
87template <> struct MultiVector<uint16x4_t, 2> { using type = uint16x4x2_t; };
88template <> struct MultiVector<int32x2_t, 2> { using type = int32x2x2_t; };
89template <> struct MultiVector<uint32x2_t, 2> { using type = uint32x2x2_t; };
90template <> struct MultiVector<int64x1_t, 2> { using type = int64x1x2_t; };
91template <> struct MultiVector<uint64x1_t, 2> { using type = uint64x1x2_t; };
92
93template <> struct MultiVector<int8x8_t, 3> { using type = int8x8x3_t; };
94template <> struct MultiVector<uint8x8_t, 3> { using type = uint8x8x3_t; };
95template <> struct MultiVector<int16x4_t, 3> { using type = int16x4x3_t; };
96template <> struct MultiVector<uint16x4_t, 3> { using type = uint16x4x3_t; };
97template <> struct MultiVector<int32x2_t, 3> { using type = int32x2x3_t; };
98template <> struct MultiVector<uint32x2_t, 3> { using type = uint32x2x3_t; };
99template <> struct MultiVector<int64x1_t, 3> { using type = int64x1x3_t; };
100template <> struct MultiVector<uint64x1_t, 3> { using type = uint64x1x3_t; };
101
102template <> struct MultiVector<int8x8_t, 4> { using type = int8x8x4_t; };
103template <> struct MultiVector<uint8x8_t, 4> { using type = uint8x8x4_t; };
104template <> struct MultiVector<int16x4_t, 4> { using type = int16x4x4_t; };
105template <> struct MultiVector<uint16x4_t, 4> { using type = uint16x4x4_t; };
106template <> struct MultiVector<int32x2_t, 4> { using type = int32x2x4_t; };
107template <> struct MultiVector<uint32x2_t, 4> { using type = uint32x2x4_t; };
108template <> struct MultiVector<int64x1_t, 4> { using type = int64x1x4_t; };
109template <> struct MultiVector<uint64x1_t, 4> { using type = uint64x1x4_t; };
110
111#if ARGON_HAS_HALF_FLOAT
112template <> struct MultiVector<float16x4_t, 2> { using type = float16x4x2_t; };
113template <> struct MultiVector<float16x4_t, 3> { using type = float16x4x3_t; };
114template <> struct MultiVector<float16x4_t, 4> { using type = float16x4x4_t; };
115#endif
116#endif
118
122template <typename T, size_t size>
123using MultiVector_t = MultiVector<T, size>::type;
124}
125
126#undef simd
Header file for SIMD features and platform detection.
SIMDe's NEON implementation (x86 and other non-Arm hosts) under the NEON intrinsic names.
Helper template for multi-vector types of different SIMD types and sizes.
Definition multivector.hpp:22