ROOT  6.06/09
Reference Guide
types.h
Go to the documentation of this file.
1 /* This file is part of the Vc library.
2 
3  Copyright (C) 2009-2012 Matthias Kretz <kretz@kde.org>
4 
5  Vc is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as
7  published by the Free Software Foundation, either version 3 of
8  the License, or (at your option) any later version.
9 
10  Vc is distributed in the hope that it will be useful, but
11  WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with Vc. If not, see <http://www.gnu.org/licenses/>.
17 
18 */
19 
20 #ifndef AVX_TYPES_H
21 #define AVX_TYPES_H
22 
23 #include "intrinsics.h"
24 #include "../common/storage.h"
25 #include "macros.h"
26 
27 #define VC_DOUBLE_V_SIZE 4
28 #define VC_FLOAT_V_SIZE 8
29 #define VC_SFLOAT_V_SIZE 8
30 #define VC_INT_V_SIZE 8
31 #define VC_UINT_V_SIZE 8
32 #define VC_SHORT_V_SIZE 8
33 #define VC_USHORT_V_SIZE 8
34 
35 #include "../common/types.h"
36 
37 namespace ROOT {
38 namespace Vc
39 {
40 namespace AVX
41 {
42  template<typename T> class Vector;
43 
44  template<unsigned int VectorSize, size_t RegisterWidth> class Mask;
45 
46  template<typename T> struct VectorHelper {};
47  template<typename T> struct GatherHelper;
48  template<typename T> struct ScatterHelper;
49 
50  template<typename T> struct IndexTypeHelper;
51  template<> struct IndexTypeHelper< char > { typedef unsigned char Type; };
52  template<> struct IndexTypeHelper<unsigned char > { typedef unsigned char Type; };
53  template<> struct IndexTypeHelper< short> { typedef unsigned short Type; };
54  template<> struct IndexTypeHelper<unsigned short> { typedef unsigned short Type; };
55  template<> struct IndexTypeHelper< int > { typedef unsigned int Type; };
56  template<> struct IndexTypeHelper<unsigned int > { typedef unsigned int Type; };
57  template<> struct IndexTypeHelper< float> { typedef unsigned int Type; };
58  template<> struct IndexTypeHelper< sfloat> { typedef unsigned short Type; };
59  template<> struct IndexTypeHelper< double> { typedef unsigned int Type; }; // _M128I based int32 would be nice
60 
61  template<typename T> struct VectorTypeHelper;
62  template<> struct VectorTypeHelper< char > { typedef m128i Type; };
63  template<> struct VectorTypeHelper<unsigned char > { typedef m128i Type; };
64  template<> struct VectorTypeHelper< short> { typedef m128i Type; };
65  template<> struct VectorTypeHelper<unsigned short> { typedef m128i Type; };
66  template<> struct VectorTypeHelper< int > { typedef m256i Type; };
67  template<> struct VectorTypeHelper<unsigned int > { typedef m256i Type; };
68  template<> struct VectorTypeHelper< float> { typedef m256 Type; };
69  template<> struct VectorTypeHelper< sfloat> { typedef m256 Type; };
70  template<> struct VectorTypeHelper< double> { typedef m256d Type; };
71 
72  template<typename T> struct SseVectorType;
73  template<> struct SseVectorType<m256 > { typedef m128 Type; };
74  template<> struct SseVectorType<m256i> { typedef m128i Type; };
75  template<> struct SseVectorType<m256d> { typedef m128d Type; };
76  template<> struct SseVectorType<m128 > { typedef m128 Type; };
77  template<> struct SseVectorType<m128i> { typedef m128i Type; };
78  template<> struct SseVectorType<m128d> { typedef m128d Type; };
79 
80  template<typename T> struct HasVectorDivisionHelper { enum { Value = 1 }; };
81  //template<> struct HasVectorDivisionHelper<unsigned int> { enum { Value = 0 }; };
82 
83  template<typename T> struct VectorHelperSize;
84 
85 #ifdef VC_MSVC
86  // MSVC's __declspec(align(#)) only works with numbers, no enums or sizeof allowed ;(
87  template<size_t size> class _VectorAlignedBaseHack;
88  template<> class STRUCT_ALIGN1( 8) _VectorAlignedBaseHack< 8> {} STRUCT_ALIGN2( 8);
89  template<> class STRUCT_ALIGN1(16) _VectorAlignedBaseHack<16> {} STRUCT_ALIGN2(16);
90  template<> class STRUCT_ALIGN1(32) _VectorAlignedBaseHack<32> {} STRUCT_ALIGN2(32);
91  template<> class STRUCT_ALIGN1(64) _VectorAlignedBaseHack<64> {} STRUCT_ALIGN2(64);
92  template<typename V = Vector<float> >
93  class VectorAlignedBaseT : public _VectorAlignedBaseHack<sizeof(V)>
94  {
95  public:
97  };
98 #else
99  template<typename V = Vector<float> >
100  class STRUCT_ALIGN1(sizeof(V)) VectorAlignedBaseT
101  {
102  public:
104  } STRUCT_ALIGN2(sizeof(V));
105 #endif
106 } // namespace AVX
107 } // namespace Vc
108 } // namespace ROOT
109 #include "undomacros.h"
110 
111 #endif // AVX_TYPES_H
Namespace for new ROOT classes and functions.
Definition: ROOT.py:1
#define FREE_STORE_OPERATORS_ALIGNED(alignment)
Definition: macros.h:165
struct STRUCT_ALIGN1(64) c_general
Definition: const_data.h:34
__m128i m128i
Definition: intrinsics.h:112
__m256d m256d
Definition: intrinsics.h:114
#define AVX
Definition: global.h:90
__m256i m256i
Definition: intrinsics.h:115
Definition: casts.h:28
__m128d m128d
Definition: intrinsics.h:111