Vectorization.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_SYSTEM_VECTORIZATION_H_
36 #define _BLAZE_SYSTEM_VECTORIZATION_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
45 
46 
47 
48 
49 //=================================================================================================
50 //
51 // AVX2 ENFORCEMENT
52 //
53 //=================================================================================================
54 
55 //*************************************************************************************************
57 #ifdef BLAZE_ENFORCE_AVX2
58 # ifndef BLAZE_ENFORCE_AVX
59 # define BLAZE_ENFORCE_AVX
60 # endif
61 # ifndef __AVX2__
62 # define __AVX2__
63 # endif
64 #endif
65 
66 //*************************************************************************************************
67 
68 
69 
70 
71 //=================================================================================================
72 //
73 // AVX ENFORCEMENT
74 //
75 //=================================================================================================
76 
77 //*************************************************************************************************
79 #ifdef BLAZE_ENFORCE_AVX
80 # ifndef __MMX__
81 # define __MMX__
82 # endif
83 # ifndef __SSE__
84 # define __SSE__
85 # endif
86 # ifndef __SSE2__
87 # define __SSE2__
88 # endif
89 # ifndef __SSE3__
90 # define __SSE3__
91 # endif
92 # ifndef __SSSE3__
93 # define __SSSE3__
94 # endif
95 # ifndef __SSE4_1__
96 # define __SSE4_1__
97 # endif
98 # ifndef __SSE4_2__
99 # define __SSE4_2__
100 # endif
101 # ifndef __AVX__
102 # define __AVX__
103 # endif
104 #endif
105 
106 //*************************************************************************************************
107 
108 
109 
110 
111 //=================================================================================================
112 //
113 // SSE/AVX/MIC MODE CONFIGURATION
114 //
115 //=================================================================================================
116 
117 //*************************************************************************************************
126 #if BLAZE_USE_VECTORIZATION && ( defined(__SSE__) || ( _M_IX86_FP > 0 ) )
127 # define BLAZE_SSE_MODE 1
128 #else
129 # define BLAZE_SSE_MODE 0
130 #endif
131 //*************************************************************************************************
132 
133 
134 //*************************************************************************************************
143 #if BLAZE_USE_VECTORIZATION && ( defined(__SSE2__) || ( _M_IX86_FP > 1 ) )
144 # define BLAZE_SSE2_MODE 1
145 #else
146 # define BLAZE_SSE2_MODE 0
147 #endif
148 //*************************************************************************************************
149 
150 
151 //*************************************************************************************************
160 #if BLAZE_USE_VECTORIZATION && defined(__SSE3__)
161 # define BLAZE_SSE3_MODE 1
162 #else
163 # define BLAZE_SSE3_MODE 0
164 #endif
165 //*************************************************************************************************
166 
167 
168 //*************************************************************************************************
177 #if BLAZE_USE_VECTORIZATION && defined(__SSSE3__)
178 # define BLAZE_SSSE3_MODE 1
179 #else
180 # define BLAZE_SSSE3_MODE 0
181 #endif
182 //*************************************************************************************************
183 
184 
185 //*************************************************************************************************
194 #if BLAZE_USE_VECTORIZATION && ( defined(__SSE4_2__) || defined(__SSE4_1__) )
195 # define BLAZE_SSE4_MODE 1
196 #else
197 # define BLAZE_SSE4_MODE 0
198 #endif
199 //*************************************************************************************************
200 
201 
202 //*************************************************************************************************
211 #if BLAZE_USE_VECTORIZATION && defined(__AVX__)
212 # define BLAZE_AVX_MODE 1
213 #else
214 # define BLAZE_AVX_MODE 0
215 #endif
216 //*************************************************************************************************
217 
218 
219 //*************************************************************************************************
228 #if BLAZE_USE_VECTORIZATION && defined(__AVX2__)
229 # define BLAZE_AVX2_MODE 1
230 #else
231 # define BLAZE_AVX2_MODE 0
232 #endif
233 //*************************************************************************************************
234 
235 
236 //*************************************************************************************************
245 #if BLAZE_USE_VECTORIZATION && defined(__MIC__)
246 # define BLAZE_MIC_MODE 1
247 #else
248 # define BLAZE_MIC_MODE 0
249 #endif
250 //*************************************************************************************************
251 
252 
253 
254 
255 //=================================================================================================
256 //
257 // COMPILE TIME CONSTRAINTS
258 //
259 //=================================================================================================
260 
261 //*************************************************************************************************
263 namespace {
264 
271 
272 }
274 //*************************************************************************************************
275 
276 
277 
278 
279 //=================================================================================================
280 //
281 // SSE/AVX/MIC INCLUDE FILE CONFIGURATION
282 //
283 //=================================================================================================
284 
285 #if BLAZE_MIC_MODE || BLAZE_AVX_MODE || BLAZE_AVX2_MODE
286 # include <immintrin.h>
287 #elif BLAZE_SSE4_MODE
288 # include <smmintrin.h>
289 #elif BLAZE_SSSE3_MODE
290 # include <tmmintrin.h>
291 #elif BLAZE_SSE3_MODE
292 # include <pmmintrin.h>
293 #elif BLAZE_SSE2_MODE
294 # include <emmintrin.h>
295 #elif BLAZE_SSE_MODE
296 # include <xmmintrin.h>
297 #endif
298 
299 #endif
#define BLAZE_AVX2_MODE
Compilation switch for the AVX2 mode.This compilation switch enables/disables the AVX2 mode...
Definition: Vectorization.h:231
#define BLAZE_SSE3_MODE
Compilation switch for the SSE3 mode.This compilation switch enables/disables the SSE3 mode...
Definition: Vectorization.h:163
#define BLAZE_SSSE3_MODE
Compilation switch for the SSSE3 mode.This compilation switch enables/disables the SSSE3 mode...
Definition: Vectorization.h:180
Compile time assertion.
#define BLAZE_SSE_MODE
Compilation switch for the SSE mode.This compilation switch enables/disables the SSE mode...
Definition: Vectorization.h:129
#define BLAZE_SSE4_MODE
Compilation switch for the SSE4 mode.This compilation switch enables/disables the SSE4 mode...
Definition: Vectorization.h:197
#define BLAZE_AVX_MODE
Compilation switch for the AVX mode.This compilation switch enables/disables the AVX mode...
Definition: Vectorization.h:214
Configuration of the vectorization policy of the Blaze library.
#define BLAZE_SSE2_MODE
Compilation switch for the SSE2 mode.This compilation switch enables/disables the SSE2 mode...
Definition: Vectorization.h:146
#define BLAZE_STATIC_ASSERT(expr)
Compile time assertion macro.In case of an invalid compile time expression, a compilation error is cr...
Definition: StaticAssert.h:143