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