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 // FMA MODE CONFIGURATION
258 //
259 //=================================================================================================
260 
261 //*************************************************************************************************
270 #if BLAZE_USE_VECTORIZATION && defined(__FMA__)
271 # define BLAZE_FMA_MODE 1
272 #else
273 # define BLAZE_FMA_MODE 0
274 #endif
275 //*************************************************************************************************
276 
277 
278 
279 
280 //=================================================================================================
281 //
282 // SVML MODE CONFIGURATION
283 //
284 //=================================================================================================
285 
286 //*************************************************************************************************
295 #if BLAZE_USE_VECTORIZATION && ( defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC) )
296 # define BLAZE_SVML_MODE 1
297 #else
298 # define BLAZE_SVML_MODE 0
299 #endif
300 //*************************************************************************************************
301 
302 
303 
304 
305 //=================================================================================================
306 //
307 // COMPILE TIME CONSTRAINTS
308 //
309 //=================================================================================================
310 
311 //*************************************************************************************************
313 namespace {
314 
321 
322 }
324 //*************************************************************************************************
325 
326 
327 
328 
329 //=================================================================================================
330 //
331 // SSE/AVX/MIC INCLUDE FILE CONFIGURATION
332 //
333 //=================================================================================================
334 
335 #if BLAZE_MIC_MODE || BLAZE_AVX_MODE || BLAZE_AVX2_MODE
336 # include <immintrin.h>
337 #elif BLAZE_SSE4_MODE
338 # include <smmintrin.h>
339 #elif BLAZE_SSSE3_MODE
340 # include <tmmintrin.h>
341 #elif BLAZE_SSE3_MODE
342 # include <pmmintrin.h>
343 #elif BLAZE_SSE2_MODE
344 # include <emmintrin.h>
345 #elif BLAZE_SSE_MODE
346 # include <xmmintrin.h>
347 #endif
348 
349 #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:112