2
Copyright 2010-2011, D. E. Shaw Research.
5
Redistribution and use in source and binary forms, with or without
6
modification, are permitted provided that the following conditions are
9
* Redistributions of source code must retain the above copyright
10
notice, this list of conditions, and the following disclaimer.
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.
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.
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.
32
Copyright (c) 2013, Los Alamos National Security, LLC
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.
45
#ifndef __pgccfeatures_dot_hpp
46
#define __pgccfeatures_dot_hpp
48
#if !defined(__x86_64__) && !defined(__i386__)
49
# error "This code has only been tested on x86 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). */
58
#ifndef R123_STATIC_INLINE
59
#define R123_STATIC_INLINE static inline
62
/* Found this example in PGI's emmintrin.h. */
63
#ifndef R123_FORCE_INLINE
64
#define R123_FORCE_INLINE(decl) decl __attribute__((__always_inline__))
67
#ifndef R123_CUDA_DEVICE
68
#define R123_CUDA_DEVICE
73
#define R123_ASSERT(x) assert(x)
76
#ifndef R123_BUILTIN_EXPECT
77
#define R123_BUILTIN_EXPECT(expr,likely) (expr)
80
/* PGI through 13.2 doesn't appear to support AES-NI. */
81
#ifndef R123_USE_AES_NI
82
#define R123_USE_AES_NI 0
85
/* PGI through 13.2 appears to support MMX, SSE, SSE3, SSE3, SSSE3, SSE4a, and
86
ABM, but not SSE4.1 or SSE4.2. */
87
#ifndef R123_USE_SSE4_2
88
#define R123_USE_SSE4_2 0
91
#ifndef R123_USE_SSE4_1
92
#define R123_USE_SSE4_1 0
96
/* There's no point in trying to compile SSE code in Random123
97
unless SSE2 is available. */
99
#define R123_USE_SSE 1
101
#define R123_USE_SSE 0
105
#ifndef R123_USE_AES_OPENSSL
106
/* There isn't really a good way to tell at compile time whether
107
openssl is available. Without a pre-compilation configure-like
108
tool, it's less error-prone to guess that it isn't available. Add
109
-DR123_USE_AES_OPENSSL=1 and any necessary LDFLAGS or LDLIBS to
111
#define R123_USE_AES_OPENSSL 0
114
#ifndef R123_USE_GNU_UINT128
115
#define R123_USE_GNU_UINT128 0
118
#ifndef R123_USE_ASM_GNU
119
#define R123_USE_ASM_GNU 1
122
#ifndef R123_USE_CPUID_MSVC
123
#define R123_USE_CPUID_MSVC 0
126
#ifndef R123_USE_X86INTRIN_H
127
#define R123_USE_X86INTRIN_H 0
130
#ifndef R123_USE_IA32INTRIN_H
131
#define R123_USE_IA32INTRIN_H 0
134
/* emmintrin.h from PGI #includes xmmintrin.h but then complains at link time
135
about undefined references to _mm_castsi128_ps(__m128i). Why? */
136
#ifndef R123_USE_XMMINTRIN_H
137
#define R123_USE_XMMINTRIN_H 1
140
#ifndef R123_USE_EMMINTRIN_H
141
#define R123_USE_EMMINTRIN_H 1
144
#ifndef R123_USE_SMMINTRIN_H
145
#define R123_USE_SMMINTRIN_H 0
148
#ifndef R123_USE_WMMINTRIN_H
149
#define R123_USE_WMMINTRIN_H 0
152
#ifndef R123_USE_INTRIN_H
154
#define R123_USE_INTRIN_H 1
156
#define R123_USE_INTRIN_H 0
160
#ifndef R123_USE_MULHILO32_ASM
161
#define R123_USE_MULHILO32_ASM 0
164
#ifndef R123_USE_MULHILO64_MULHI_INTRIN
165
#define R123_USE_MULHILO64_MULHI_INTRIN 0
168
#ifndef R123_USE_MULHILO64_ASM
169
#define R123_USE_MULHILO64_ASM 1
172
#ifndef R123_USE_MULHILO64_MSVC_INTRIN
173
#define R123_USE_MULHILO64_MSVC_INTRIN 0
176
#ifndef R123_USE_MULHILO64_CUDA_INTRIN
177
#define R123_USE_MULHILO64_CUDA_INTRIN 0
180
#ifndef R123_USE_MULHILO64_OPENCL_INTRIN
181
#define R123_USE_MULHILO64_OPENCL_INTRIN 0
184
#ifndef __STDC_CONSTANT_MACROS
185
#define __STDC_CONSTANT_MACROS
189
#error UINT64_C not defined. You must define __STDC_CONSTANT_MACROS before you #include <stdint.h>
192
/* If you add something, it must go in all the other XXfeatures.hpp
193
and in ../ut_features.cpp */