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
#ifndef __msvcfeatures_dot_hpp
33
#define __msvcfeatures_dot_hpp
35
//#if _MSVC_FULL_VER <= 15
36
//#error "We've only tested MSVC_FULL_VER==15."
39
#if !defined(_M_IX86) && !defined(_M_X64)
40
# error "This code has only been tested on x86 platforms."
41
{ // maybe an unbalanced brace will terminate the compilation
42
// You are invited to try Random123 on other architectures, by changing
43
// the conditions that reach this error, but you should consider it a
44
// porting exercise and expect to encounter bugs and deficiencies.
45
// Please let the authors know of any successes (or failures).
48
#ifndef R123_STATIC_INLINE
49
#define R123_STATIC_INLINE static __inline
52
#ifndef R123_FORCE_INLINE
53
#define R123_FORCE_INLINE(decl) _forceinline decl
56
#ifndef R123_CUDA_DEVICE
57
#define R123_CUDA_DEVICE
62
#define R123_ASSERT(x) assert(x)
65
#ifndef R123_BUILTIN_EXPECT
66
#define R123_BUILTIN_EXPECT(expr,likely) expr
69
// The basic idiom is:
70
// #ifndef R123_SOMETHING
72
// #define R123_SOMETHING 1
74
// #define R123_SOMETHING 0
77
// This idiom allows an external user to override any decision
78
// in this file with a command-line -DR123_SOMETHING=1 or -DR123_SOMETHINE=0
80
// An alternative idiom is:
81
// #ifndef R123_SOMETHING
82
// #define R123_SOMETHING (some boolean expression)
84
// where the boolean expression might contain previously-defined R123_SOMETHING_ELSE
87
#ifndef R123_USE_AES_NI
89
#define R123_USE_AES_NI 1
91
#define R123_USE_AES_NI 0
95
#ifndef R123_USE_SSE4_2
97
#define R123_USE_SSE4_2 1
99
#define R123_USE_SSE4_2 0
103
#ifndef R123_USE_SSE4_1
105
#define R123_USE_SSE4_1 1
107
#define R123_USE_SSE4_1 0
112
#define R123_USE_SSE 1
115
#ifndef R123_USE_AES_OPENSSL
116
#define R123_USE_AES_OPENSSL 0
119
#ifndef R123_USE_GNU_UINT128
120
#define R123_USE_GNU_UINT128 0
123
#ifndef R123_USE_ASM_GNU
124
#define R123_USE_ASM_GNU 0
127
#ifndef R123_USE_CPUID_MSVC
128
#define R123_USE_CPUID_MSVC 1
131
#ifndef R123_USE_X86INTRIN_H
132
#define R123_USE_X86INTRIN_H 0
135
#ifndef R123_USE_IA32INTRIN_H
136
#define R123_USE_IA32INTRIN_H 0
139
#ifndef R123_USE_XMMINTRIN_H
140
#define R123_USE_XMMINTRIN_H 0
143
#ifndef R123_USE_EMMINTRIN_H
144
#define R123_USE_EMMINTRIN_H 1
147
#ifndef R123_USE_SMMINTRIN_H
148
#define R123_USE_SMMINTRIN_H 1
151
#ifndef R123_USE_WMMINTRIN_H
152
#define R123_USE_WMMINTRIN_H 1
155
#ifndef R123_USE_INTRIN_H
156
#define R123_USE_INTRIN_H 1
159
#ifndef R123_USE_MULHILO16_ASM
160
#define R123_USE_MULHILO16_ASM 0
163
#ifndef R123_USE_MULHILO32_ASM
164
#define R123_USE_MULHILO32_ASM 0
167
#ifndef R123_USE_MULHILO64_ASM
168
#define R123_USE_MULHILO64_ASM 0
171
#ifndef R123_USE_MULHILO64_MSVC_INTRIN
173
#define R123_USE_MULHILO64_MSVC_INTRIN 1
175
#define R123_USE_MULHILO64_MSVC_INTRIN 0
179
#ifndef R123_USE_MULHILO64_CUDA_INTRIN
180
#define R123_USE_MULHILO64_CUDA_INTRIN 0
183
#ifndef R123_USE_MULHILO64_OPENCL_INTRIN
184
#define R123_USE_MULHILO64_OPENCL_INTRIN 0
187
#ifndef __STDC_CONSTANT_MACROS
188
#define __STDC_CONSTANT_MACROS
192
#error UINT64_C not defined. You must define __STDC_CONSTANT_MACROS before you #include <stdint.h>
195
#pragma warning(disable:4244)
196
#pragma warning(disable:4996)
198
// If you add something, it must go in all the other XXfeatures.hpp
199
// and in ../ut_features.cpp