blob: 045839cf4854679307eefb29b9350a47ce834a7e [file] [log] [blame]
Georgios Pinitas82833b82018-01-30 12:14:24 +00001/*
2 * Copyright (c) 2018 ARM Limited.
3 *
4 * SPDX-License-Identifier: MIT
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
24#ifndef __ARM_COMPUTE_WRAPPER_TRAITS_H__
25#define __ARM_COMPUTE_WRAPPER_TRAITS_H__
26
27#include <arm_neon.h>
28
29namespace arm_compute
30{
31namespace wrapper
32{
33namespace traits
34{
35// *INDENT-OFF*
36// clang-format off
37
38/** Create the appropriate NEON vector given its type and size */
39template <typename T, int S> struct neon_vector;
40/** Specializations */
41template <> struct neon_vector<uint8_t, 8>{ using type = uint8x8_t; };
42template <> struct neon_vector<int8_t, 8>{ using type = int8x8_t; };
43template <> struct neon_vector<uint8_t, 16>{ using type = uint8x16_t; };
44template <> struct neon_vector<int8_t, 16>{ using type = int8x16_t; };
45template <> struct neon_vector<uint16_t, 4>{ using type = uint16x4_t; };
46template <> struct neon_vector<int16_t, 4>{ using type = int16x4_t; };
47template <> struct neon_vector<uint16_t, 8>{ using type = uint16x8_t; };
48template <> struct neon_vector<int16_t, 8>{ using type = int16x8_t; };
49template <> struct neon_vector<uint32_t, 2>{ using type = uint32x2_t; };
50template <> struct neon_vector<int32_t, 2>{ using type = int32x2_t; };
51template <> struct neon_vector<uint32_t, 4>{ using type = uint32x4_t; };
52template <> struct neon_vector<int32_t, 4>{ using type = int32x4_t; };
53template <> struct neon_vector<uint64_t, 1>{ using type = uint64x1_t; };
54template <> struct neon_vector<int64_t, 1>{ using type = int64x1_t; };
55template <> struct neon_vector<uint64_t, 2>{ using type = uint64x2_t; };
56template <> struct neon_vector<int64_t, 2>{ using type = int64x2_t; };
57template <> struct neon_vector<float_t, 2>{ using type = float32x2_t; };
58template <> struct neon_vector<float_t, 4>{ using type = float32x4_t; };
59template <typename T, int S> using neon_vector_t = typename neon_vector<T, S>::type;
60// clang-format on
61// *INDENT-ON*
62}
63}
64}
65#endif /* __ARM_COMPUTE_WRAPPER_TRAITS_H__ */