NEURON
xlcfeatures.h
Go to the documentation of this file.
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 Copyright (c) 2013, Los Alamos National Security, LLC
33 All rights reserved.
34 
35 Copyright 2013. Los Alamos National Security, LLC. This software was produced
36 under U.S. Government contract DE-AC52-06NA25396 for Los Alamos National
37 Laboratory (LANL), which is operated by Los Alamos National Security, LLC for
38 the U.S. Department of Energy. The U.S. Government has rights to use,
39 reproduce, and distribute this software. NEITHER THE GOVERNMENT NOR LOS
40 ALAMOS NATIONAL SECURITY, LLC MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR
41 ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE. If software is modified
42 to produce derivative works, such modified software should be clearly marked,
43 so as not to confuse it with the version available from LANL.
44 */
45 #ifndef __xlcfeatures_dot_hpp
46 #define __xlcfeatures_dot_hpp
47 
48 #if !defined(__x86_64__) && !defined(__i386__) && !defined(__powerpc__)
49 # error "This code has only been tested on x86 and PowerPC platforms."
50 #include <including_a_nonexistent_file_will_stop_some_compilers_from_continuing_with_a_hopeless_task>
51 { /* maybe an unbalanced brace will terminate the compilation */
52  /* Feel free to try the Random123 library on other architectures by changing
53  the conditions that reach this error, but you should consider it a
54  porting exercise and expect to encounter bugs and deficiencies.
55  Please let the authors know of any successes (or failures). */
56 #endif
57 
58 #ifdef __cplusplus
59 /* builtins are automatically available to xlc. To use them with xlc++,
60  one must include builtins.h. c.f
61  http://publib.boulder.ibm.com/infocenter/cellcomp/v101v121/index.jsp?topic=/com.ibm.xlcpp101.cell.doc/compiler_ref/compiler_builtins.html
62 */
63 #include <builtins.h>
64 #endif
65 
66 #ifndef R123_STATIC_INLINE
67 #define R123_STATIC_INLINE static inline
68 #endif
69 
70 #ifndef R123_FORCE_INLINE
71 #define R123_FORCE_INLINE(decl) decl __attribute__((__always_inline__))
72 #endif
73 
74 #ifndef R123_CUDA_DEVICE
75 #define R123_CUDA_DEVICE
76 #endif
77 
78 #ifndef R123_ASSERT
79 #include <assert.h>
80 #define R123_ASSERT(x) assert(x)
81 #endif
82 
83 #ifndef R123_BUILTIN_EXPECT
84 #define R123_BUILTIN_EXPECT(expr,likely) __builtin_expect(expr,likely)
85 #endif
86 
87 #ifndef R123_USE_AES_NI
88 #define R123_USE_AES_NI 0
89 #endif
90 
91 #ifndef R123_USE_SSE4_2
92 #define R123_USE_SSE4_2 0
93 #endif
94 
95 #ifndef R123_USE_SSE4_1
96 #define R123_USE_SSE4_1 0
97 #endif
98 
99 #ifndef R123_USE_SSE
100 #define R123_USE_SSE 0
101 #endif
102 
103 #ifndef R123_USE_AES_OPENSSL
104 /* There isn't really a good way to tell at compile time whether
105  openssl is available. Without a pre-compilation configure-like
106  tool, it's less error-prone to guess that it isn't available. Add
107  -DR123_USE_AES_OPENSSL=1 and any necessary LDFLAGS or LDLIBS to
108  play with openssl */
109 #define R123_USE_AES_OPENSSL 0
110 #endif
111 
112 #ifndef R123_USE_GNU_UINT128
113 #define R123_USE_GNU_UINT128 0
114 #endif
115 
116 #ifndef R123_USE_ASM_GNU
117 #define R123_USE_ASM_GNU 1
118 #endif
119 
120 #ifndef R123_USE_CPUID_MSVC
121 #define R123_USE_CPUID_MSVC 0
122 #endif
123 
124 #ifndef R123_USE_X86INTRIN_H
125 #define R123_USE_X86INTRIN_H 0
126 #endif
127 
128 #ifndef R123_USE_IA32INTRIN_H
129 #define R123_USE_IA32INTRIN_H 0
130 #endif
131 
132 #ifndef R123_USE_XMMINTRIN_H
133 #define R123_USE_XMMINTRIN_H 0
134 #endif
135 
136 #ifndef R123_USE_EMMINTRIN_H
137 #define R123_USE_EMMINTRIN_H 0
138 #endif
139 
140 #ifndef R123_USE_SMMINTRIN_H
141 #define R123_USE_SMMINTRIN_H 0
142 #endif
143 
144 #ifndef R123_USE_WMMINTRIN_H
145 #define R123_USE_WMMINTRIN_H 0
146 #endif
147 
148 #ifndef R123_USE_INTRIN_H
149 #ifdef __ABM__
150 #define R123_USE_INTRIN_H 1
151 #else
152 #define R123_USE_INTRIN_H 0
153 #endif
154 #endif
155 
156 #ifndef R123_USE_MULHILO32_ASM
157 #define R123_USE_MULHILO32_ASM 0
158 #endif
159 
160 #ifndef R123_USE_MULHILO64_MULHI_INTRIN
161 #if (defined(__powerpc64__))
162 #define R123_USE_MULHILO64_MULHI_INTRIN 1
163 #else
164 #define R123_USE_MULHILO64_MULHI_INTRIN 0
165 #endif
166 #endif
167 
168 #ifndef R123_MULHILO64_MULHI_INTRIN
169 #define R123_MULHILO64_MULHI_INTRIN __mulhdu
170 #endif
171 
172 #ifndef R123_USE_MULHILO32_MULHI_INTRIN
173 #define R123_USE_MULHILO32_MULHI_INTRIN 0
174 #endif
175 
176 #ifndef R123_MULHILO32_MULHI_INTRIN
177 #define R123_MULHILO32_MULHI_INTRIN __mulhwu
178 #endif
179 
180 #ifndef R123_USE_MULHILO64_ASM
181 #if (defined(__powerpc64__) && !(R123_USE_MULHILO64_MULHI_INTRIN))
182 #define R123_USE_MULHILO64_ASM 1
183 #else
184 #define R123_USE_MULHILO64_ASM 0
185 #endif
186 #endif
187 
188 #ifndef R123_USE_MULHILO64_MSVC_INTRIN
189 #define R123_USE_MULHILO64_MSVC_INTRIN 0
190 #endif
191 
192 #ifndef R123_USE_MULHILO64_CUDA_INTRIN
193 #define R123_USE_MULHILO64_CUDA_INTRIN 0
194 #endif
195 
196 #ifndef R123_USE_MULHILO64_OPENCL_INTRIN
197 #define R123_USE_MULHILO64_OPENCL_INTRIN 0
198 #endif
199 
200 #ifndef __STDC_CONSTANT_MACROS
201 #define __STDC_CONSTANT_MACROS
202 #endif
203 #include <stdint.h>
204 #ifndef UINT64_C
205 #error UINT64_C not defined. You must define __STDC_CONSTANT_MACROS before you #include <stdint.h>
206 #endif
207 
208 /* If you add something, it must go in all the other XXfeatures.hpp
209  and in ../ut_features.cpp */
210 #endif