Blaze 3.9
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// SSE/AVX MACRO DEFINITIONS
52//
53//=================================================================================================
54
55//*************************************************************************************************
57#ifdef __AVX512F__
58# ifndef __AVX2__
59# define __AVX2__
60# endif
61#endif
63//*************************************************************************************************
64
65
66//*************************************************************************************************
68#ifdef __AVX2__
69# ifndef __AVX__
70# define __AVX__
71# endif
72#endif
74//*************************************************************************************************
75
76
77//*************************************************************************************************
79#ifdef __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#endif
103//*************************************************************************************************
104
105
106
107
108//=================================================================================================
109//
110// SSE/AVX/MIC MODE CONFIGURATION
111//
112//=================================================================================================
113
114//*************************************************************************************************
123#if BLAZE_USE_VECTORIZATION && ( defined(__SSE__) || defined(_M_AMD64) || defined(_M_X64) || ( _M_IX86_FP > 0 ) )
124# define BLAZE_SSE_MODE 1
125#else
126# define BLAZE_SSE_MODE 0
127#endif
128//*************************************************************************************************
129
130
131//*************************************************************************************************
140#if BLAZE_USE_VECTORIZATION && ( defined(__SSE2__) || defined(_M_AMD64) || defined(_M_X64) || ( _M_IX86_FP > 1 ) )
141# define BLAZE_SSE2_MODE 1
142#else
143# define BLAZE_SSE2_MODE 0
144#endif
145//*************************************************************************************************
146
147
148//*************************************************************************************************
157#if BLAZE_USE_VECTORIZATION && defined(__SSE3__)
158# define BLAZE_SSE3_MODE 1
159#else
160# define BLAZE_SSE3_MODE 0
161#endif
162//*************************************************************************************************
163
164
165//*************************************************************************************************
174#if BLAZE_USE_VECTORIZATION && defined(__SSSE3__)
175# define BLAZE_SSSE3_MODE 1
176#else
177# define BLAZE_SSSE3_MODE 0
178#endif
179//*************************************************************************************************
180
181
182//*************************************************************************************************
191#if BLAZE_USE_VECTORIZATION && ( defined(__SSE4_2__) || defined(__SSE4_1__) )
192# define BLAZE_SSE4_MODE 1
193#else
194# define BLAZE_SSE4_MODE 0
195#endif
196//*************************************************************************************************
197
198
199//*************************************************************************************************
208#if BLAZE_USE_VECTORIZATION && defined(__AVX__)
209# define BLAZE_AVX_MODE 1
210#else
211# define BLAZE_AVX_MODE 0
212#endif
213//*************************************************************************************************
214
215
216//*************************************************************************************************
225#if BLAZE_USE_VECTORIZATION && defined(__AVX2__)
226# define BLAZE_AVX2_MODE 1
227#else
228# define BLAZE_AVX2_MODE 0
229#endif
230//*************************************************************************************************
231
232
233//*************************************************************************************************
243#if BLAZE_USE_VECTORIZATION && defined(__AVX512F__)
244# define BLAZE_AVX512F_MODE 1
245#else
246# define BLAZE_AVX512F_MODE 0
247#endif
248//*************************************************************************************************
249
250
251//*************************************************************************************************
261#if BLAZE_USE_VECTORIZATION && defined(__AVX512BW__)
262# define BLAZE_AVX512BW_MODE 1
263#else
264# define BLAZE_AVX512BW_MODE 0
265#endif
266//*************************************************************************************************
267
268
269//*************************************************************************************************
279#if BLAZE_USE_VECTORIZATION && defined(__AVX512DQ__)
280# define BLAZE_AVX512DQ_MODE 1
281#else
282# define BLAZE_AVX512DQ_MODE 0
283#endif
284//*************************************************************************************************
285
286
287//*************************************************************************************************
296#if BLAZE_USE_VECTORIZATION && defined(__MIC__)
297# define BLAZE_MIC_MODE 1
298#else
299# define BLAZE_MIC_MODE 0
300#endif
301//*************************************************************************************************
302
303
304
305
306//=================================================================================================
307//
308// FMA MODE CONFIGURATION
309//
310//=================================================================================================
311
312//*************************************************************************************************
321#if BLAZE_USE_VECTORIZATION && defined(__FMA__)
322# define BLAZE_FMA_MODE 1
323#else
324# define BLAZE_FMA_MODE 0
325#endif
326//*************************************************************************************************
327
328
329
330
331//=================================================================================================
332//
333// SVML MODE CONFIGURATION
334//
335//=================================================================================================
336
337//*************************************************************************************************
346#if BLAZE_USE_VECTORIZATION && ( defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC) )
347# define BLAZE_SVML_MODE 1
348#else
349# define BLAZE_SVML_MODE 0
350#endif
351//*************************************************************************************************
352
353
354//*************************************************************************************************
363#if BLAZE_USE_VECTORIZATION && BLAZE_USE_SLEEF
364# define BLAZE_SLEEF_MODE 1
365#else
366# define BLAZE_SLEEF_MODE 0
367#endif
368//*************************************************************************************************
369
370
371
372
373//=================================================================================================
374//
375// COMPILE TIME CONSTRAINTS
376//
377//=================================================================================================
378
379//*************************************************************************************************
381namespace {
382
392
393}
395//*************************************************************************************************
396
397
398
399
400//=================================================================================================
401//
402// SSE/AVX/MIC INCLUDE FILE CONFIGURATION
403//
404//=================================================================================================
405
406#if BLAZE_AVX512F_MODE || BLAZE_MIC_MODE || BLAZE_AVX2_MODE || BLAZE_AVX_MODE
407# include <immintrin.h>
408#elif BLAZE_SSE4_MODE
409# include <smmintrin.h>
410#elif BLAZE_SSSE3_MODE
411# include <tmmintrin.h>
412#elif BLAZE_SSE3_MODE
413# include <pmmintrin.h>
414#elif BLAZE_SSE2_MODE
415# include <emmintrin.h>
416#elif BLAZE_SSE_MODE
417# include <xmmintrin.h>
418#endif
419
420#endif
Compile time assertion.
Configuration of the vectorization policy of the Blaze library.
#define BLAZE_STATIC_ASSERT(expr)
Compile time assertion macro.
Definition: StaticAssert.h:112
#define BLAZE_AVX_MODE
Compilation switch for the AVX mode.
Definition: Vectorization.h:211
#define BLAZE_AVX512F_MODE
Compilation switch for the AVX512F mode.
Definition: Vectorization.h:246
#define BLAZE_SSE4_MODE
Compilation switch for the SSE4 mode.
Definition: Vectorization.h:194
#define BLAZE_AVX512BW_MODE
Compilation switch for the AVX512BW mode.
Definition: Vectorization.h:264
#define BLAZE_AVX2_MODE
Compilation switch for the AVX2 mode.
Definition: Vectorization.h:228
#define BLAZE_SSE_MODE
Compilation switch for the SSE mode.
Definition: Vectorization.h:126
#define BLAZE_SSSE3_MODE
Compilation switch for the SSSE3 mode.
Definition: Vectorization.h:177
#define BLAZE_SSE3_MODE
Compilation switch for the SSE3 mode.
Definition: Vectorization.h:160
#define BLAZE_AVX512DQ_MODE
Compilation switch for the AVX512DQ mode.
Definition: Vectorization.h:282
#define BLAZE_SSE2_MODE
Compilation switch for the SSE2 mode.
Definition: Vectorization.h:143