All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AlignmentTrait.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_UTIL_ALIGNMENTTRAIT_H_
36 #define _BLAZE_UTIL_ALIGNMENTTRAIT_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <boost/type_traits/alignment_of.hpp>
45 #include <blaze/util/Complex.h>
49 
50 
51 namespace blaze {
52 
53 //=================================================================================================
54 //
55 // SIZETRAIT CLASS DEFINITION
56 //
57 //=================================================================================================
58 
59 //*************************************************************************************************
78 template< typename T >
80 {
81  public:
82  //**Member enumerations*************************************************************************
84 #if BLAZE_MIC_MODE
85  enum { value = ( IsVectorizable<T>::value )?( 64UL ):( boost::alignment_of<T>::value ) };
86 #elif BLAZE_AVX2_MODE
87  enum { value = ( IsVectorizable<T>::value )?( 32UL ):( boost::alignment_of<T>::value ) };
88 #elif BLAZE_SSE2_MODE
89  enum { value = ( IsVectorizable<T>::value )?( 16UL ):( boost::alignment_of<T>::value ) };
90 #else
91  enum { value = boost::alignment_of<T>::value };
92 #endif
93 
94  //**********************************************************************************************
95 
96  private:
97  //**Compile time checks*************************************************************************
102  //**********************************************************************************************
103 };
104 //*************************************************************************************************
105 
106 
107 //*************************************************************************************************
112 template<>
113 struct AlignmentTrait<float>
114 {
115  public:
116  //**Member enumerations*************************************************************************
117 #if BLAZE_MIC_MODE
118  enum { value = 64UL };
119 #elif BLAZE_AVX_MODE
120  enum { value = 32UL };
121 #elif BLAZE_SSE_MODE
122  enum { value = 16UL };
123 #else
124  enum { value = boost::alignment_of<float>::value };
125 #endif
126  //**********************************************************************************************
127 };
129 //*************************************************************************************************
130 
131 
132 //*************************************************************************************************
137 template<>
138 struct AlignmentTrait<double>
139 {
140  public:
141  //**Member enumerations*************************************************************************
142 #if BLAZE_MIC_MODE
143  enum { value = 64UL };
144 #elif BLAZE_AVX_MODE
145  enum { value = 32UL };
146 #elif BLAZE_SSE_MODE
147  enum { value = 16UL };
148 #else
149  enum { value = boost::alignment_of<double>::value };
150 #endif
151  //**********************************************************************************************
152 };
154 //*************************************************************************************************
155 
156 
157 //*************************************************************************************************
162 template<>
163 struct AlignmentTrait< complex<float> >
164 {
165  public:
166  //**Member enumerations*************************************************************************
167 #if BLAZE_MIC_MODE
168  enum { value = 64UL };
169 #elif BLAZE_AVX_MODE
170  enum { value = 32UL };
171 #elif BLAZE_SSE_MODE
172  enum { value = 16UL };
173 #else
174  enum { value = boost::alignment_of< complex<float> >::value };
175 #endif
176  //**********************************************************************************************
177 };
179 //*************************************************************************************************
180 
181 
182 //*************************************************************************************************
187 template<>
188 struct AlignmentTrait< complex<double> >
189 {
190  public:
191  //**Member enumerations*************************************************************************
192 #if BLAZE_MIC_MODE
193  enum { value = 64UL };
194 #elif BLAZE_AVX_MODE
195  enum { value = 32UL };
196 #elif BLAZE_SSE_MODE
197  enum { value = 16UL };
198 #else
199  enum { value = boost::alignment_of< complex<double> >::value };
200 #endif
201  //**********************************************************************************************
202 };
204 //*************************************************************************************************
205 
206 } // namespace blaze
207 
208 #endif
Compile time check for vectorizable types.Depending on the available instruction set (SSE...
Definition: IsVectorizable.h:107
#define BLAZE_CONSTRAINT_MUST_NOT_BE_CONST(T)
Constraint on the data type.In case the given data type is a const-qualified type, a compilation error is created.
Definition: Const.h:116
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.In case the given data type is a volatile-qualified type, a compilation error is created.
Definition: Volatile.h:116
Constraint on the data type.
Header file for the IsVectorizable type trait.
Constraint on the data type.
Evaluation of the required alignment of the given data type.The AlignmentTrait class template evaluat...
Definition: AlignmentTrait.h:79
System settings for the SSE mode.
Header file for the complex data type.