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
17namespace simdpp {
18namespace SIMDPP_ARCH_NAMESPACE {
19namespace detail {
20
21struct 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
34struct 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
47struct 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
60template<class T> struct same_width;
61template<> struct same_width<int8x16 > : vec128_impl {};
62template<> struct same_width<uint8x16 > : vec128_impl {};
63template<> struct same_width<int16x8 > : vec128_impl {};
64template<> struct same_width<uint16x8 > : vec128_impl {};
65template<> struct same_width<int32x4 > : vec128_impl {};
66template<> struct same_width<uint32x4 > : vec128_impl {};
67template<> struct same_width<int64x2 > : vec128_impl {};
68template<> struct same_width<uint64x2 > : vec128_impl {};
69template<> struct same_width<float32x4> : vec128_impl {};
70template<> struct same_width<float64x2> : vec128_impl {};
71
72template<> struct same_width< int8x32 > : vec256_impl {};
73template<> struct same_width<uint8x32 > : vec256_impl {};
74template<> struct same_width< int16x16> : vec256_impl {};
75template<> struct same_width<uint16x16> : vec256_impl {};
76template<> struct same_width< int32x8 > : vec256_impl {};
77template<> struct same_width<uint32x8 > : vec256_impl {};
78template<> struct same_width< int64x4 > : vec256_impl {};
79template<> struct same_width<uint64x4 > : vec256_impl {};
80template<> struct same_width<float32x8> : vec256_impl {};
81template<> struct same_width<float64x4> : vec256_impl {};
82
83template<> struct same_width< int8<64> > : vec512_impl {};
84template<> struct same_width<uint8<64> > : vec512_impl {};
85template<> struct same_width< int16<32> > : vec512_impl {};
86template<> struct same_width<uint16<32> > : vec512_impl {};
87template<> struct same_width< int32<16> > : vec512_impl {};
88template<> struct same_width<uint32<16> > : vec512_impl {};
89template<> struct same_width< int64<8> > : vec512_impl {};
90template<> struct same_width<uint64<8> > : vec512_impl {};
91template<> struct same_width<float32<16>> : vec512_impl {};
92template<> struct same_width<float64<8> > : vec512_impl {};
93
94} // namespace detail
95} // namespace SIMDPP_ARCH_NAMESPACE
96} // namespace simdpp
97
98#endif
99