Merge tag 'upstream/1.09+dfsg'
Upstream version 1.09+dfsg
Andreas Tille
7 years ago
0 | /* | |
1 | Copyright 2010-2011, D. E. Shaw Research. | |
2 | All rights reserved. | |
3 | ||
4 | Redistribution and use in source and binary forms, with or without | |
5 | modification, are permitted provided that the following conditions are | |
6 | met: | |
7 | ||
8 | * Redistributions of source code must retain the above copyright | |
9 | notice, this list of conditions, and the following disclaimer. | |
10 | ||
11 | * Redistributions in binary form must reproduce the above copyright | |
12 | notice, this list of conditions, and the following disclaimer in the | |
13 | documentation and/or other materials provided with the distribution. | |
14 | ||
15 | * Neither the name of D. E. Shaw Research nor the names of its | |
16 | contributors may be used to endorse or promote products derived from | |
17 | this software without specific prior written permission. | |
18 | ||
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
20 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
21 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
22 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
23 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
24 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
25 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
26 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
27 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
30 | ||
31 | Copyright (c) 2013, Los Alamos National Security, LLC | |
32 | All rights reserved. | |
33 | ||
34 | Copyright 2013. Los Alamos National Security, LLC. This software was produced | |
35 | under U.S. Government contract DE-AC52-06NA25396 for Los Alamos National | |
36 | Laboratory (LANL), which is operated by Los Alamos National Security, LLC for | |
37 | the U.S. Department of Energy. The U.S. Government has rights to use, | |
38 | reproduce, and distribute this software. NEITHER THE GOVERNMENT NOR LOS | |
39 | ALAMOS NATIONAL SECURITY, LLC MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR | |
40 | ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE. If software is modified | |
41 | to produce derivative works, such modified software should be clearly marked, | |
42 | so as not to confuse it with the version available from LANL. | |
43 | */ | |
44 | #ifndef __pgccfeatures_dot_hpp | |
45 | #define __pgccfeatures_dot_hpp | |
46 | ||
47 | #if !defined(__x86_64__) && !defined(__i386__) | |
48 | # error "This code has only been tested on x86 platforms." | |
49 | #include <including_a_nonexistent_file_will_stop_some_compilers_from_continuing_with_a_hopeless_task> | |
50 | { /* maybe an unbalanced brace will terminate the compilation */ | |
51 | /* Feel free to try the Random123 library on other architectures by changing | |
52 | the conditions that reach this error, but you should consider it a | |
53 | porting exercise and expect to encounter bugs and deficiencies. | |
54 | Please let the authors know of any successes (or failures). */ | |
55 | #endif | |
56 | ||
57 | #ifndef R123_STATIC_INLINE | |
58 | #define R123_STATIC_INLINE static inline | |
59 | #endif | |
60 | ||
61 | /* Found this example in PGI's emmintrin.h. */ | |
62 | #ifndef R123_FORCE_INLINE | |
63 | #define R123_FORCE_INLINE(decl) decl __attribute__((__always_inline__)) | |
64 | #endif | |
65 | ||
66 | #ifndef R123_CUDA_DEVICE | |
67 | #define R123_CUDA_DEVICE | |
68 | #endif | |
69 | ||
70 | #ifndef R123_ASSERT | |
71 | #include <assert.h> | |
72 | #define R123_ASSERT(x) assert(x) | |
73 | #endif | |
74 | ||
75 | #ifndef R123_BUILTIN_EXPECT | |
76 | #define R123_BUILTIN_EXPECT(expr,likely) (expr) | |
77 | #endif | |
78 | ||
79 | /* PGI through 13.2 doesn't appear to support AES-NI. */ | |
80 | #ifndef R123_USE_AES_NI | |
81 | #define R123_USE_AES_NI 0 | |
82 | #endif | |
83 | ||
84 | /* PGI through 13.2 appears to support MMX, SSE, SSE3, SSE3, SSSE3, SSE4a, and | |
85 | ABM, but not SSE4.1 or SSE4.2. */ | |
86 | #ifndef R123_USE_SSE4_2 | |
87 | #define R123_USE_SSE4_2 0 | |
88 | #endif | |
89 | ||
90 | #ifndef R123_USE_SSE4_1 | |
91 | #define R123_USE_SSE4_1 0 | |
92 | #endif | |
93 | ||
94 | #ifndef R123_USE_SSE | |
95 | /* There's no point in trying to compile SSE code in Random123 | |
96 | unless SSE2 is available. */ | |
97 | #ifdef __SSE2__ | |
98 | #define R123_USE_SSE 1 | |
99 | #else | |
100 | #define R123_USE_SSE 0 | |
101 | #endif | |
102 | #endif | |
103 | ||
104 | #ifndef R123_USE_AES_OPENSSL | |
105 | /* There isn't really a good way to tell at compile time whether | |
106 | openssl is available. Without a pre-compilation configure-like | |
107 | tool, it's less error-prone to guess that it isn't available. Add | |
108 | -DR123_USE_AES_OPENSSL=1 and any necessary LDFLAGS or LDLIBS to | |
109 | play with openssl */ | |
110 | #define R123_USE_AES_OPENSSL 0 | |
111 | #endif | |
112 | ||
113 | #ifndef R123_USE_GNU_UINT128 | |
114 | #define R123_USE_GNU_UINT128 0 | |
115 | #endif | |
116 | ||
117 | #ifndef R123_USE_ASM_GNU | |
118 | #define R123_USE_ASM_GNU 1 | |
119 | #endif | |
120 | ||
121 | #ifndef R123_USE_CPUID_MSVC | |
122 | #define R123_USE_CPUID_MSVC 0 | |
123 | #endif | |
124 | ||
125 | #ifndef R123_USE_X86INTRIN_H | |
126 | #define R123_USE_X86INTRIN_H 0 | |
127 | #endif | |
128 | ||
129 | #ifndef R123_USE_IA32INTRIN_H | |
130 | #define R123_USE_IA32INTRIN_H 0 | |
131 | #endif | |
132 | ||
133 | /* emmintrin.h from PGI #includes xmmintrin.h but then complains at link time | |
134 | about undefined references to _mm_castsi128_ps(__m128i). Why? */ | |
135 | #ifndef R123_USE_XMMINTRIN_H | |
136 | #define R123_USE_XMMINTRIN_H 1 | |
137 | #endif | |
138 | ||
139 | #ifndef R123_USE_EMMINTRIN_H | |
140 | #define R123_USE_EMMINTRIN_H 1 | |
141 | #endif | |
142 | ||
143 | #ifndef R123_USE_SMMINTRIN_H | |
144 | #define R123_USE_SMMINTRIN_H 0 | |
145 | #endif | |
146 | ||
147 | #ifndef R123_USE_WMMINTRIN_H | |
148 | #define R123_USE_WMMINTRIN_H 0 | |
149 | #endif | |
150 | ||
151 | #ifndef R123_USE_INTRIN_H | |
152 | #ifdef __ABM__ | |
153 | #define R123_USE_INTRIN_H 1 | |
154 | #else | |
155 | #define R123_USE_INTRIN_H 0 | |
156 | #endif | |
157 | #endif | |
158 | ||
159 | #ifndef R123_USE_MULHILO32_ASM | |
160 | #define R123_USE_MULHILO32_ASM 0 | |
161 | #endif | |
162 | ||
163 | #ifndef R123_USE_MULHILO64_MULHI_INTRIN | |
164 | #define R123_USE_MULHILO64_MULHI_INTRIN 0 | |
165 | #endif | |
166 | ||
167 | #ifndef R123_USE_MULHILO64_ASM | |
168 | #define R123_USE_MULHILO64_ASM 1 | |
169 | #endif | |
170 | ||
171 | #ifndef R123_USE_MULHILO64_MSVC_INTRIN | |
172 | #define R123_USE_MULHILO64_MSVC_INTRIN 0 | |
173 | #endif | |
174 | ||
175 | #ifndef R123_USE_MULHILO64_CUDA_INTRIN | |
176 | #define R123_USE_MULHILO64_CUDA_INTRIN 0 | |
177 | #endif | |
178 | ||
179 | #ifndef R123_USE_MULHILO64_OPENCL_INTRIN | |
180 | #define R123_USE_MULHILO64_OPENCL_INTRIN 0 | |
181 | #endif | |
182 | ||
183 | #ifndef __STDC_CONSTANT_MACROS | |
184 | #define __STDC_CONSTANT_MACROS | |
185 | #endif | |
186 | #include <stdint.h> | |
187 | #ifndef UINT64_C | |
188 | #error UINT64_C not defined. You must define __STDC_CONSTANT_MACROS before you #include <stdint.h> | |
189 | #endif | |
190 | ||
191 | /* If you add something, it must go in all the other XXfeatures.hpp | |
192 | and in ../ut_features.cpp */ | |
193 | #endif |
0 | /* | |
1 | Copyright 2010-2011, D. E. Shaw Research. | |
2 | All rights reserved. | |
3 | ||
4 | Redistribution and use in source and binary forms, with or without | |
5 | modification, are permitted provided that the following conditions are | |
6 | met: | |
7 | ||
8 | * Redistributions of source code must retain the above copyright | |
9 | notice, this list of conditions, and the following disclaimer. | |
10 | ||
11 | * Redistributions in binary form must reproduce the above copyright | |
12 | notice, this list of conditions, and the following disclaimer in the | |
13 | documentation and/or other materials provided with the distribution. | |
14 | ||
15 | * Neither the name of D. E. Shaw Research nor the names of its | |
16 | contributors may be used to endorse or promote products derived from | |
17 | this software without specific prior written permission. | |
18 | ||
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
20 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
21 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
22 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
23 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
24 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
25 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
26 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
27 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
30 | ||
31 | Copyright (c) 2013, Los Alamos National Security, LLC | |
32 | All rights reserved. | |
33 | ||
34 | Copyright 2013. Los Alamos National Security, LLC. This software was produced | |
35 | under U.S. Government contract DE-AC52-06NA25396 for Los Alamos National | |
36 | Laboratory (LANL), which is operated by Los Alamos National Security, LLC for | |
37 | the U.S. Department of Energy. The U.S. Government has rights to use, | |
38 | reproduce, and distribute this software. NEITHER THE GOVERNMENT NOR LOS | |
39 | ALAMOS NATIONAL SECURITY, LLC MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR | |
40 | ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE. If software is modified | |
41 | to produce derivative works, such modified software should be clearly marked, | |
42 | so as not to confuse it with the version available from LANL. | |
43 | */ | |
44 | #ifndef __xlcfeatures_dot_hpp | |
45 | #define __xlcfeatures_dot_hpp | |
46 | ||
47 | #if !defined(__x86_64__) && !defined(__i386__) && !defined(__powerpc__) | |
48 | # error "This code has only been tested on x86 and PowerPC platforms." | |
49 | #include <including_a_nonexistent_file_will_stop_some_compilers_from_continuing_with_a_hopeless_task> | |
50 | { /* maybe an unbalanced brace will terminate the compilation */ | |
51 | /* Feel free to try the Random123 library on other architectures by changing | |
52 | the conditions that reach this error, but you should consider it a | |
53 | porting exercise and expect to encounter bugs and deficiencies. | |
54 | Please let the authors know of any successes (or failures). */ | |
55 | #endif | |
56 | ||
57 | #ifdef __cplusplus | |
58 | /* builtins are automatically available to xlc. To use them with xlc++, | |
59 | one must include builtins.h. c.f | |
60 | http://publib.boulder.ibm.com/infocenter/cellcomp/v101v121/index.jsp?topic=/com.ibm.xlcpp101.cell.doc/compiler_ref/compiler_builtins.html | |
61 | */ | |
62 | #include <builtins.h> | |
63 | #endif | |
64 | ||
65 | #ifndef R123_STATIC_INLINE | |
66 | #define R123_STATIC_INLINE static inline | |
67 | #endif | |
68 | ||
69 | #ifndef R123_FORCE_INLINE | |
70 | #define R123_FORCE_INLINE(decl) decl __attribute__((__always_inline__)) | |
71 | #endif | |
72 | ||
73 | #ifndef R123_CUDA_DEVICE | |
74 | #define R123_CUDA_DEVICE | |
75 | #endif | |
76 | ||
77 | #ifndef R123_ASSERT | |
78 | #include <assert.h> | |
79 | #define R123_ASSERT(x) assert(x) | |
80 | #endif | |
81 | ||
82 | #ifndef R123_BUILTIN_EXPECT | |
83 | #define R123_BUILTIN_EXPECT(expr,likely) __builtin_expect(expr,likely) | |
84 | #endif | |
85 | ||
86 | #ifndef R123_USE_AES_NI | |
87 | #define R123_USE_AES_NI 0 | |
88 | #endif | |
89 | ||
90 | #ifndef R123_USE_SSE4_2 | |
91 | #define R123_USE_SSE4_2 0 | |
92 | #endif | |
93 | ||
94 | #ifndef R123_USE_SSE4_1 | |
95 | #define R123_USE_SSE4_1 0 | |
96 | #endif | |
97 | ||
98 | #ifndef R123_USE_SSE | |
99 | #define R123_USE_SSE 0 | |
100 | #endif | |
101 | ||
102 | #ifndef R123_USE_AES_OPENSSL | |
103 | /* There isn't really a good way to tell at compile time whether | |
104 | openssl is available. Without a pre-compilation configure-like | |
105 | tool, it's less error-prone to guess that it isn't available. Add | |
106 | -DR123_USE_AES_OPENSSL=1 and any necessary LDFLAGS or LDLIBS to | |
107 | play with openssl */ | |
108 | #define R123_USE_AES_OPENSSL 0 | |
109 | #endif | |
110 | ||
111 | #ifndef R123_USE_GNU_UINT128 | |
112 | #define R123_USE_GNU_UINT128 0 | |
113 | #endif | |
114 | ||
115 | #ifndef R123_USE_ASM_GNU | |
116 | #define R123_USE_ASM_GNU 1 | |
117 | #endif | |
118 | ||
119 | #ifndef R123_USE_CPUID_MSVC | |
120 | #define R123_USE_CPUID_MSVC 0 | |
121 | #endif | |
122 | ||
123 | #ifndef R123_USE_X86INTRIN_H | |
124 | #define R123_USE_X86INTRIN_H 0 | |
125 | #endif | |
126 | ||
127 | #ifndef R123_USE_IA32INTRIN_H | |
128 | #define R123_USE_IA32INTRIN_H 0 | |
129 | #endif | |
130 | ||
131 | #ifndef R123_USE_XMMINTRIN_H | |
132 | #define R123_USE_XMMINTRIN_H 0 | |
133 | #endif | |
134 | ||
135 | #ifndef R123_USE_EMMINTRIN_H | |
136 | #define R123_USE_EMMINTRIN_H 0 | |
137 | #endif | |
138 | ||
139 | #ifndef R123_USE_SMMINTRIN_H | |
140 | #define R123_USE_SMMINTRIN_H 0 | |
141 | #endif | |
142 | ||
143 | #ifndef R123_USE_WMMINTRIN_H | |
144 | #define R123_USE_WMMINTRIN_H 0 | |
145 | #endif | |
146 | ||
147 | #ifndef R123_USE_INTRIN_H | |
148 | #ifdef __ABM__ | |
149 | #define R123_USE_INTRIN_H 1 | |
150 | #else | |
151 | #define R123_USE_INTRIN_H 0 | |
152 | #endif | |
153 | #endif | |
154 | ||
155 | #ifndef R123_USE_MULHILO32_ASM | |
156 | #define R123_USE_MULHILO32_ASM 0 | |
157 | #endif | |
158 | ||
159 | #ifndef R123_USE_MULHILO64_MULHI_INTRIN | |
160 | #define R123_USE_MULHILO64_MULHI_INTRIN (defined(__powerpc64__)) | |
161 | #endif | |
162 | ||
163 | #ifndef R123_MULHILO64_MULHI_INTRIN | |
164 | #define R123_MULHILO64_MULHI_INTRIN __mulhdu | |
165 | #endif | |
166 | ||
167 | #ifndef R123_USE_MULHILO32_MULHI_INTRIN | |
168 | #define R123_USE_MULHILO32_MULHI_INTRIN 0 | |
169 | #endif | |
170 | ||
171 | #ifndef R123_MULHILO32_MULHI_INTRIN | |
172 | #define R123_MULHILO32_MULHI_INTRIN __mulhwu | |
173 | #endif | |
174 | ||
175 | #ifndef R123_USE_MULHILO64_ASM | |
176 | #define R123_USE_MULHILO64_ASM (defined(__powerpc64__) && !(R123_USE_MULHILO64_MULHI_INTRIN)) | |
177 | #endif | |
178 | ||
179 | #ifndef R123_USE_MULHILO64_MSVC_INTRIN | |
180 | #define R123_USE_MULHILO64_MSVC_INTRIN 0 | |
181 | #endif | |
182 | ||
183 | #ifndef R123_USE_MULHILO64_CUDA_INTRIN | |
184 | #define R123_USE_MULHILO64_CUDA_INTRIN 0 | |
185 | #endif | |
186 | ||
187 | #ifndef R123_USE_MULHILO64_OPENCL_INTRIN | |
188 | #define R123_USE_MULHILO64_OPENCL_INTRIN 0 | |
189 | #endif | |
190 | ||
191 | #ifndef __STDC_CONSTANT_MACROS | |
192 | #define __STDC_CONSTANT_MACROS | |
193 | #endif | |
194 | #include <stdint.h> | |
195 | #ifndef UINT64_C | |
196 | #error UINT64_C not defined. You must define __STDC_CONSTANT_MACROS before you #include <stdint.h> | |
197 | #endif | |
198 | ||
199 | /* If you add something, it must go in all the other XXfeatures.hpp | |
200 | and in ../ut_features.cpp */ | |
201 | #endif |