T-SIMD v31.1.0
A C++ template SIMD library
Loading...
Searching...
No Matches
intrins_neon.H
1// ===========================================================================
2//
3// includes include files for vector intrinsics on ARM CPUs
4//
5// This source code file is part of the following software:
6//
7// - the low-level C++ template SIMD library
8// - the SIMD implementation of the MinWarping and the 2D-Warping methods
9// for local visual homing.
10//
11// The software is provided based on the accompanying license agreement in the
12// file LICENSE.md.
13// The software is provided "as is" without any warranty by the licensor and
14// without any liability of the licensor, and the software may not be
15// distributed by the licensee; see the license agreement for details.
16//
17// (C) Ralf Möller
18// Computer Engineering
19// Faculty of Technology
20// Bielefeld University
21// www.ti.uni-bielefeld.de
22//
23// ===========================================================================
24
25#pragma once
26#ifndef SIMD_INTRINS_NEON_H_
27#define SIMD_INTRINS_NEON_H_
28
29#include "../defs.H"
30
31#ifdef SIMDVEC_NEON_ENABLE
32#include <arm_neon.h>
33
34// -------------------------------------------------------------------------
35// single element array type (for generalizations)
36// -------------------------------------------------------------------------
37
38// defined as the other array types in arm_neon.h
39// but with type conversion constructor and operator=
40#define SIMDVEC_NEON_64X1(NEON_T) \
41 struct NEON_T##x1_t \
42 { \
43 NEON_T##_t val[1]; \
44 NEON_T##x1_t() {} \
45 NEON_T##x1_t(const NEON_T##_t &x) \
46 { \
47 val[0] = x; \
48 } \
49 NEON_T##x1_t &operator=(const NEON_T##_t &x) \
50 { \
51 val[0] = x; \
52 return *this; \
53 } \
54 };
55
56SIMDVEC_NEON_64X1(uint8x8)
57SIMDVEC_NEON_64X1(int8x8)
58SIMDVEC_NEON_64X1(uint16x4)
59SIMDVEC_NEON_64X1(int16x4)
60SIMDVEC_NEON_64X1(int32x2)
61SIMDVEC_NEON_64X1(float32x2)
62#ifdef SIMD_64BIT_TYPES
63SIMDVEC_NEON_64X1(int64x1)
64SIMDVEC_NEON_64X1(float64x1)
65#endif
66
67#undef SIMDVEC_NEON_64X1
68
69// -------------------------------------------------------------------------
70// vreinterpret[q] with same input and output type (not avail. as intrinsic)
71// -------------------------------------------------------------------------
72
73#define SIMDVEC_NEON_VREINTERPRET_SAME(T, NEON_SUF) \
74 static SIMD_INLINE T vreinterpretq_##NEON_SUF##_##NEON_SUF(T a) \
75 { \
76 return a; \
77 }
78
79SIMDVEC_NEON_VREINTERPRET_SAME(uint8x16_t, u8)
80SIMDVEC_NEON_VREINTERPRET_SAME(int8x16_t, s8)
81SIMDVEC_NEON_VREINTERPRET_SAME(uint16x8_t, u16)
82SIMDVEC_NEON_VREINTERPRET_SAME(int16x8_t, s16)
83SIMDVEC_NEON_VREINTERPRET_SAME(uint32x4_t, u32)
84SIMDVEC_NEON_VREINTERPRET_SAME(int32x4_t, s32)
85SIMDVEC_NEON_VREINTERPRET_SAME(float32x4_t, f32)
86#ifdef SIMD_64BIT_TYPES
87SIMDVEC_NEON_VREINTERPRET_SAME(uint64x2_t, u64)
88SIMDVEC_NEON_VREINTERPRET_SAME(int64x2_t, s64)
89SIMDVEC_NEON_VREINTERPRET_SAME(float64x2_t, f64)
90#endif
91
92#endif
93
94#endif // SIMD_INTRINS_NEON_H_