1 /*  This file is part of the Vc library. {{{
2 Copyright © 2009-2015 Matthias Kretz <kretz@kde.org>
3 
4 Redistribution and use in source and binary forms, with or without
5 modification, are permitted provided that the following conditions are met:
6     * Redistributions of source code must retain the above copyright
7       notice, this list of conditions and the following disclaimer.
8     * Redistributions in binary form must reproduce the above copyright
9       notice, this list of conditions and the following disclaimer in the
10       documentation and/or other materials provided with the distribution.
11     * Neither the names of contributing organizations nor the
12       names of its contributors may be used to endorse or promote products
13       derived from this software without specific prior written permission.
14 
15 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
19 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 
26 }}}*/
27 
28 #include "../scalar/types.h"
29 
30 #ifndef VC_SSE_TYPES_H_
31 #define VC_SSE_TYPES_H_
32 
33 #ifdef Vc_DEFAULT_IMPL_SSE
34 #define Vc_DOUBLE_V_SIZE 2
35 #define Vc_FLOAT_V_SIZE 4
36 #define Vc_INT_V_SIZE 4
37 #define Vc_UINT_V_SIZE 4
38 #define Vc_SHORT_V_SIZE 8
39 #define Vc_USHORT_V_SIZE 8
40 #endif
41 
42 namespace Vc_VERSIONED_NAMESPACE
43 {
44 namespace SSE
45 {
46 template <typename T> using Vector = Vc::Vector<T, VectorAbi::Sse>;
47 typedef Vector<double>         double_v;
48 typedef Vector<float>           float_v;
49 typedef Vector<int>               int_v;
50 typedef Vector<unsigned int>     uint_v;
51 typedef Vector<short>           short_v;
52 typedef Vector<unsigned short> ushort_v;
53 
54 template <typename T> using Mask = Vc::Mask<T, VectorAbi::Sse>;
55 typedef Mask<double>         double_m;
56 typedef Mask<float>           float_m;
57 typedef Mask<int>               int_m;
58 typedef Mask<unsigned int>     uint_m;
59 typedef Mask<short>           short_m;
60 typedef Mask<unsigned short> ushort_m;
61 
62 template <typename T> struct Const;
63 
64 template <typename T> struct is_vector : public std::false_type {};
65 template <typename T> struct is_vector<Vector<T>> : public std::true_type {};
66 template <typename T> struct is_mask : public std::false_type {};
67 template <typename T> struct is_mask<Mask<T>> : public std::true_type {};
68 }  // namespace SSE
69 
70 namespace Traits
71 {
72 template <class T> struct
73 is_simd_vector_internal<Vector<T, VectorAbi::Sse>>
74   : public is_valid_vector_argument<T> {};
75 
76 template<typename T> struct is_simd_mask_internal<Mask<T, VectorAbi::Sse>>
77   : public std::true_type {};
78 }  // namespace Traits
79 }  // namespace Vc
80 
81 #endif // VC_SSE_TYPES_H_
82