Fix selection of xtc groups not starting at index 0
[alexxy/gromacs.git] / src / external / Random123-1.08 / include / Random123 / features / iccfeatures.h
1 /*
2 Copyright 2010-2011, D. E. Shaw Research.
3 All rights reserved.
4
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are
7 met:
8
9 * Redistributions of source code must retain the above copyright
10   notice, this list of conditions, and the following disclaimer.
11
12 * Redistributions in binary form must reproduce the above copyright
13   notice, this list of conditions, and the following disclaimer in the
14   documentation and/or other materials provided with the distribution.
15
16 * Neither the name of D. E. Shaw Research nor the names of its
17   contributors may be used to endorse or promote products derived from
18   this software without specific prior written permission.
19
20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32 #ifndef __icpcfeatures_dot_hpp
33 #define __icpcfeatures_dot_hpp
34
35 // icc relies on gcc libraries and other toolchain components.
36 #define R123_GNUC_VERSION (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__)
37
38 #if !defined(__x86_64__) && !defined(__i386__)
39 #  error "This code has only been tested on x86 platforms."
40 { // maybe an unbalanced brace will terminate the compilation
41 // You are invited to try Easy123 on other architectures, by changing
42 // the conditions that reach this error, but you should consider it a
43 // porting exercise and expect to encounter bugs and deficiencies.
44 // Please let the authors know of any successes (or failures).
45 #endif
46
47 #ifndef R123_STATIC_INLINE
48 #define R123_STATIC_INLINE static inline
49 #endif
50
51 #ifndef R123_FORCE_INLINE
52 #define R123_FORCE_INLINE(decl) decl __attribute__((always_inline))
53 #endif
54
55 #ifndef R123_CUDA_DEVICE
56 #define R123_CUDA_DEVICE
57 #endif
58
59 #ifndef R123_ASSERT
60 #include <assert.h>
61 #define R123_ASSERT(x) assert(x)
62 #endif
63
64 #ifndef R123_BUILTIN_EXPECT
65 #define R123_BUILTIN_EXPECT(expr,likely) __builtin_expect(expr,likely)
66 #endif
67
68 // The basic idiom is:
69 // #ifndef R123_SOMETHING
70 // #if some condition
71 // #define R123_SOMETHING 1
72 // #else
73 // #define R123_SOMETHING 0
74 // #endif
75 // #endif
76 // This idiom allows an external user to override any decision
77 // in this file with a command-line -DR123_SOMETHING=1 or -DR123_SOMETHINE=0
78
79 // An alternative idiom is:
80 // #ifndef R123_SOMETHING
81 // #define R123_SOMETHING (some boolean expression)
82 // #endif
83 // where the boolean expression might contain previously-defined R123_SOMETHING_ELSE
84 // pp-symbols.
85
86 #ifndef R123_USE_SSE4_2
87 #ifdef __SSE4_2__
88 #define R123_USE_SSE4_2 1
89 #else
90 #define R123_USE_SSE4_2 0
91 #endif
92 #endif
93
94 #ifndef R123_USE_SSE4_1
95 #ifdef __SSE4_1__
96 #define R123_USE_SSE4_1 1
97 #else
98 #define R123_USE_SSE4_1 0
99 #endif
100 #endif
101
102 #ifndef R123_USE_SSE
103 #ifdef __SSE2__
104 #define R123_USE_SSE 1
105 #else
106 #define R123_USE_SSE 0
107 #endif
108 #endif
109
110 #ifndef R123_USE_AES_NI
111 // Unlike gcc, icc (version 12) does not pre-define an __AES__
112 // pp-symbol when -maes or -xHost is on the command line.  This feels
113 // like a defect in icc (it defines __SSE4_2__ in analogous
114 // circumstances), but until Intel fixes it, we're better off erring
115 // on the side of caution and not generating instructions that are
116 // going to raise SIGILL when executed.  To get the AES-NI
117 // instructions with icc, the caller must puts something like
118 // -DR123_USE_AES_NI=1 or -D__AES__ on the command line.  FWIW, the
119 // AES-NI Whitepaper by Gueron says that icc has supported AES-NI from
120 // 11.1 onwards.
121 //
122 #define R123_USE_AES_NI ((__ICC>=1101) && defined(__AES__))
123 #endif
124
125 #ifndef R123_USE_AES_OPENSSL
126 /* There isn't really a good way to tell at compile time whether
127    openssl is available.  Without a pre-compilation configure-like
128    tool, it's less error-prone to guess that it isn't available.  Add
129    -DR123_USE_AES_OPENSSL=1 and any necessary LDFLAGS or LDLIBS to
130    play with openssl */
131 #define R123_USE_AES_OPENSSL 0
132 #endif
133
134 #ifndef R123_USE_GNU_UINT128
135 #define R123_USE_GNU_UINT128 0
136 #endif
137
138 #ifndef R123_USE_ASM_GNU
139 #define R123_USE_ASM_GNU 1
140 #endif
141
142 #ifndef R123_USE_CPUID_MSVC
143 #define R123_USE_CPUID_MSVC 0
144 #endif
145
146 #ifndef R123_USE_X86INTRIN_H
147 #define R123_USE_X86INTRIN_H 0
148 #endif
149
150 #ifndef R123_USE_IA32INTRIN_H
151 #define R123_USE_IA32INTRIN_H 1
152 #endif
153
154 #ifndef R123_USE_XMMINTRIN_H
155 #define R123_USE_XMMINTRIN_H 0
156 #endif
157
158 #ifndef R123_USE_EMMINTRIN_H
159 #define R123_USE_EMMINTRIN_H 1
160 #endif
161
162 #ifndef R123_USE_SMMINTRIN_H
163 #define R123_USE_SMMINTRIN_H 1
164 #endif
165
166 #ifndef R123_USE_WMMINTRIN_H
167 #define R123_USE_WMMINTRIN_H 1
168 #endif
169
170 #ifndef R123_USE_INTRIN_H
171 #define R123_USE_INTRIN_H 0
172 #endif
173
174 #ifndef R123_USE_MULHILO16_ASM
175 #define R123_USE_MULHILO16_ASM 0
176 #endif
177
178 #ifndef R123_USE_MULHILO32_ASM
179 #define R123_USE_MULHILO32_ASM 0
180 #endif
181
182 #ifndef R123_USE_MULHILO64_ASM
183 #define R123_USE_MULHILO64_ASM 1
184 #endif
185
186 #ifndef R123_USE_MULHILO64_MSVC_INTRIN
187 #define R123_USE_MULHILO64_MSVC_INTRIN 0
188 #endif
189
190 #ifndef R123_USE_MULHILO64_CUDA_INTRIN
191 #define R123_USE_MULHILO64_CUDA_INTRIN 0
192 #endif
193
194 #ifndef R123_USE_MULHILO64_OPENCL_INTRIN
195 #define R123_USE_MULHILO64_OPENCL_INTRIN 0
196 #endif
197
198 #ifndef __STDC_CONSTANT_MACROS
199 #define __STDC_CONSTANT_MACROS
200 #endif
201 #include <stdint.h>
202 #ifndef UINT64_C
203 #error UINT64_C not defined.  You must define __STDC_CONSTANT_MACROS before you #include <stdint.h>
204 #endif
205
206 // If you add something, it must go in all the other XXfeatures.hpp
207 // and in ../ut_features.cpp
208 #endif