Argon 0.1.0
Loading...
Searching...
No Matches
vector.hpp
1#pragma once
2#include "argon/features.h"
3
4#ifdef __ARM_NEON
5#include <arm_neon.h>
6#define simd neon
7#elifdef __ARM_FEATURE_MVE
8#include <arm_mve.h>
9#define simd mve
10#else
11#define SIMDE_ENABLE_NATIVE_ALIASES
12#include <arm/neon.h>
13#define simd neon
14#endif
15
16namespace simd {
17// clang-format off
20template <typename T, size_t Lanes> struct Vector;
21
22
24template <> struct Vector<int8_t, 16> { using type = int8x16_t; };
25template <> struct Vector<uint8_t, 16> { using type = uint8x16_t; };
26template <> struct Vector<int16_t, 8> { using type = int16x8_t; };
27template <> struct Vector<uint16_t, 8> { using type = uint16x8_t; };
28template <> struct Vector<int32_t, 4> { using type = int32x4_t; };
29template <> struct Vector<uint32_t, 4> { using type = uint32x4_t; };
30template <> struct Vector<int64_t, 2> { using type = int64x2_t; };
31template <> struct Vector<uint64_t, 2> { using type = uint64x2_t; };
32
33#if ARGON_HAS_SINGLE_FLOAT
34template <> struct Vector<float, 4> {using type = float32x4_t; };
35#endif
36
37#if ARGON_HAS_HALF_FLOAT
38template <> struct Vector<float16_t, 8> {using type = float16x8_t; };
39#endif
40
41#if ARGON_HAS_DOUBLE_FLOAT
42template <> struct Vector<float64_t, 2> {using type = float64x2_t; };
43#endif
44
45#ifndef ARGON_PLATFORM_MVE
46template <> struct Vector<int8_t, 8> { using type = int8x8_t; };
47template <> struct Vector<uint8_t, 8> { using type = uint8x8_t; };
48template <> struct Vector<int16_t, 4> { using type = int16x4_t; };
49template <> struct Vector<uint16_t, 4> { using type = uint16x4_t; };
50template <> struct Vector<int32_t, 2> { using type = int32x2_t; };
51template <> struct Vector<uint32_t, 2> { using type = uint32x2_t; };
52template <> struct Vector<int64_t, 1> { using type = int64x1_t; };
53template <> struct Vector<uint64_t, 1> { using type = uint64x1_t; };
54
55#if ARGON_HAS_SINGLE_FLOAT
56template <> struct Vector<float, 2> {using type = float32x2_t; };
57#endif
58
59#if ARGON_HAS_HALF_FLOAT
60template <> struct Vector<float16_t, 4> {using type = float16x4_t; };
61#endif
62
63#if ARGON_HAS_DOUBLE_FLOAT
64template <> struct Vector<float64_t, 1> {using type = float64x1_t; };
65#endif
66#endif
68
71template <typename T, size_t Lanes>
72using Vector_t = typename Vector<T, Lanes>::type;
73
74// clang-format on
75} // namespace simd
76#undef simd
Header file for SIMD features and platform detection.
Helper template to get the SIMD double-word vector type for a given scalar type.
Definition vector.hpp:20