MCKL
Monte Carlo Kernel Library
intel.h
Go to the documentation of this file.
1 //============================================================================
2 // MCKL/include/mckl/internal/compiler/intel.h
3 //----------------------------------------------------------------------------
4 // MCKL: Monte Carlo Kernel Library
5 //----------------------------------------------------------------------------
6 // Copyright (c) 2013-2018, Yan Zhou
7 // All rights reserved.
8 //
9 // Redistribution and use in source and binary forms, with or without
10 // modification, are permitted provided that the following conditions are met:
11 //
12 // Redistributions of source code must retain the above copyright notice,
13 // this list of conditions and the following disclaimer.
14 //
15 // Redistributions in binary form must reproduce the above copyright notice,
16 // this list of conditions and the following disclaimer in the documentation
17 // and/or other materials provided with the distribution.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS
20 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 // POSSIBILITY OF SUCH DAMAGE.
30 //============================================================================
31 
32 #ifndef MCKL_INTERNAL_COMPILER_INTEL_H
33 #define MCKL_INTERNAL_COMPILER_INTEL_H
34 
35 #if MCKL_HAS_X86
36 #include <x86intrin.h>
37 #endif
38 
39 #define MCKL_INTEL_VERSION __INTEL_COMPILER
40 
41 #ifndef MCKL_HAS_LITTLE_ENDIAN
42 #define MCKL_HAS_LITTLE_ENDIAN 1
43 #endif
44 
45 #ifndef MCKL_HAS_BIG_ENDIAN
46 #define MCKL_HAS_BIG_ENDIAN 0
47 #endif
48 
49 #ifdef __SSE2__
50 #ifndef MCKL_HAS_SSE2
51 #define MCKL_HAS_SSE2 1
52 #endif
53 #endif
54 
55 #ifdef __SSE3__
56 #ifndef MCKL_HAS_SSE3
57 #define MCKL_HAS_SSE3 1
58 #endif
59 #endif
60 
61 #ifdef __SSSE3__
62 #ifndef MCKL_HAS_SSSE3
63 #define MCKL_HAS_SSSE3 1
64 #endif
65 #endif
66 
67 #ifdef __SSE4_1__
68 #ifndef MCKL_HAS_SSE4_1
69 #define MCKL_HAS_SSE4_1 1
70 #endif
71 #endif
72 
73 #ifdef __SSE4_2__
74 #ifndef MCKL_HAS_SSE4_2
75 #define MCKL_HAS_SSE4_2 1
76 #endif
77 #endif
78 
79 #ifdef __AVX__
80 #ifndef MCKL_HAS_AVX
81 #define MCKL_HAS_AVX 1
82 #endif
83 #endif
84 
85 #ifdef __AVX2__
86 #ifndef MCKL_HAS_AVX2
87 #define MCKL_HAS_AVX2 1
88 #endif
89 #endif
90 
91 #if defined(__AVX512BW__) && defined(__AVX512CD__) && \
92  defined(__AVX512DQ__) && defined(__AVX512F__) && defined(__AVX512VL__)
93 #ifndef MCKL_HAS_AVX512
94 #define MCKL_HAS_AVX512 1
95 #endif
96 #endif
97 
98 #ifdef __AVX__
99 #ifndef MCKL_HAS_AESNI
100 #define MCKL_HAS_AESNI 1
101 #endif
102 #endif
103 
104 #ifdef __AVX2__
105 #ifndef MCKL_HAS_RDRAND
106 #define MCKL_HAS_RDRAND 1
107 #endif
108 #endif
109 
110 #ifdef __AVX2__
111 #ifndef MCKL_HAS_BMI
112 #define MCKL_HAS_BMI 1
113 #endif
114 #endif
115 
116 #ifdef __AVX2__
117 #ifndef MCKL_HAS_BMI2
118 #define MCKL_HAS_BMI2 1
119 #endif
120 #endif
121 
122 #ifdef __AVX2__
123 #ifndef MCKL_HAS_FMA
124 #define MCKL_HAS_FMA 1
125 #endif
126 #endif
127 
128 #ifndef MCKL_INT64
129 #define MCKL_INT64 __int64
130 #endif
131 
132 #if MCKL_HAS_X86_64
133 #ifndef MCKL_HAS_INT128
134 #define MCKL_HAS_INT128 1
135 #endif
136 #ifndef MCKL_INT128
137 #define MCKL_INT128 __int128
138 #endif
139 #endif
140 
141 #ifndef MCKL_INLINE_CALL
142 #define MCKL_INLINE_CALL _Pragma("forceinline recursive")
143 #endif
144 
145 #endif // MCKL_INTERNAL_COMPILER_INTEL_H