1 | /* Copyright (C) 2011-2012 Povilas Kanapickas <povilas@radix.lt> |
---|---|
2 | |
3 | Distributed under the Boost Software License, Version 1.0. |
4 | (See accompanying file LICENSE_1_0.txt or copy at |
5 | http://www.boost.org/LICENSE_1_0.txt) |
6 | */ |
7 | |
8 | #ifndef LIBSIMDPP_SIMDPP_DETAIL_WIDTH_H |
9 | #define LIBSIMDPP_SIMDPP_DETAIL_WIDTH_H |
10 | |
11 | #ifndef LIBSIMDPP_SIMD_H |
12 | #error "This file must be included through simd.h" |
13 | #endif |
14 | |
15 | #include <simdpp/types.h> |
16 | |
17 | namespace simdpp { |
18 | namespace SIMDPP_ARCH_NAMESPACE { |
19 | namespace detail { |
20 | |
21 | struct vec128_impl { |
22 | using i8 = int8x16; |
23 | using u8 = uint8x16; |
24 | using i16 = int16x8; |
25 | using u16 = uint16x8; |
26 | using i32 = int32x4; |
27 | using u32 = uint32x4; |
28 | using i64 = int64x2; |
29 | using u64 = uint64x2; |
30 | using f32 = float32x4; |
31 | using f64 = float64x2; |
32 | }; |
33 | |
34 | struct vec256_impl { |
35 | using i8 = int8x32; |
36 | using u8 = uint8x32; |
37 | using i16 = int16x16; |
38 | using u16 = uint16x16; |
39 | using i32 = int32x8; |
40 | using u32 = uint32x8; |
41 | using i64 = int64x4; |
42 | using u64 = uint64x4; |
43 | using f32 = float32x8; |
44 | using f64 = float64x4; |
45 | }; |
46 | |
47 | struct vec512_impl { |
48 | using i8 = int8<64>; |
49 | using u8 = uint8<64>; |
50 | using i16 = int16<32>; |
51 | using u16 = uint16<32>; |
52 | using i32 = int32<16>; |
53 | using u32 = uint32<16>; |
54 | using i64 = int64<8>; |
55 | using u64 = uint64<8>; |
56 | using f32 = float32<16>; |
57 | using f64 = float64<8>; |
58 | }; |
59 | |
60 | template<class T> struct same_width; |
61 | template<> struct same_width<int8x16 > : vec128_impl {}; |
62 | template<> struct same_width<uint8x16 > : vec128_impl {}; |
63 | template<> struct same_width<int16x8 > : vec128_impl {}; |
64 | template<> struct same_width<uint16x8 > : vec128_impl {}; |
65 | template<> struct same_width<int32x4 > : vec128_impl {}; |
66 | template<> struct same_width<uint32x4 > : vec128_impl {}; |
67 | template<> struct same_width<int64x2 > : vec128_impl {}; |
68 | template<> struct same_width<uint64x2 > : vec128_impl {}; |
69 | template<> struct same_width<float32x4> : vec128_impl {}; |
70 | template<> struct same_width<float64x2> : vec128_impl {}; |
71 | |
72 | template<> struct same_width< int8x32 > : vec256_impl {}; |
73 | template<> struct same_width<uint8x32 > : vec256_impl {}; |
74 | template<> struct same_width< int16x16> : vec256_impl {}; |
75 | template<> struct same_width<uint16x16> : vec256_impl {}; |
76 | template<> struct same_width< int32x8 > : vec256_impl {}; |
77 | template<> struct same_width<uint32x8 > : vec256_impl {}; |
78 | template<> struct same_width< int64x4 > : vec256_impl {}; |
79 | template<> struct same_width<uint64x4 > : vec256_impl {}; |
80 | template<> struct same_width<float32x8> : vec256_impl {}; |
81 | template<> struct same_width<float64x4> : vec256_impl {}; |
82 | |
83 | template<> struct same_width< int8<64> > : vec512_impl {}; |
84 | template<> struct same_width<uint8<64> > : vec512_impl {}; |
85 | template<> struct same_width< int16<32> > : vec512_impl {}; |
86 | template<> struct same_width<uint16<32> > : vec512_impl {}; |
87 | template<> struct same_width< int32<16> > : vec512_impl {}; |
88 | template<> struct same_width<uint32<16> > : vec512_impl {}; |
89 | template<> struct same_width< int64<8> > : vec512_impl {}; |
90 | template<> struct same_width<uint64<8> > : vec512_impl {}; |
91 | template<> struct same_width<float32<16>> : vec512_impl {}; |
92 | template<> struct same_width<float64<8> > : vec512_impl {}; |
93 | |
94 | } // namespace detail |
95 | } // namespace SIMDPP_ARCH_NAMESPACE |
96 | } // namespace simdpp |
97 | |
98 | #endif |
99 |