/perf/kseta

To get this branch, use:
bzr branch http://darksoft.org/webbzr/perf/kseta

« back to all changes in this revision

Viewing changes to tutorials/4_pi/random123/features/pgccfeatures.h

  • Committer: Suren A. Chilingaryan
  • Date: 2013-10-08 23:53:50 UTC
  • Revision ID: csa@dside.dyndns.org-20131008235350-hsu8oukzkh05gtcm
Add tutorials

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 __pgccfeatures_dot_hpp
 
46
#define __pgccfeatures_dot_hpp
 
47
 
 
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). */
 
56
#endif
 
57
 
 
58
#ifndef R123_STATIC_INLINE
 
59
#define R123_STATIC_INLINE static inline
 
60
#endif
 
61
 
 
62
/* Found this example in PGI's emmintrin.h. */
 
63
#ifndef R123_FORCE_INLINE
 
64
#define R123_FORCE_INLINE(decl) decl __attribute__((__always_inline__))
 
65
#endif
 
66
 
 
67
#ifndef R123_CUDA_DEVICE
 
68
#define R123_CUDA_DEVICE
 
69
#endif
 
70
 
 
71
#ifndef R123_ASSERT
 
72
#include <assert.h>
 
73
#define R123_ASSERT(x) assert(x)
 
74
#endif
 
75
 
 
76
#ifndef R123_BUILTIN_EXPECT
 
77
#define R123_BUILTIN_EXPECT(expr,likely) (expr)
 
78
#endif
 
79
 
 
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
 
83
#endif
 
84
 
 
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
 
89
#endif
 
90
 
 
91
#ifndef R123_USE_SSE4_1
 
92
#define R123_USE_SSE4_1 0
 
93
#endif
 
94
 
 
95
#ifndef R123_USE_SSE
 
96
/* There's no point in trying to compile SSE code in Random123
 
97
   unless SSE2 is available. */
 
98
#ifdef __SSE2__
 
99
#define R123_USE_SSE 1
 
100
#else
 
101
#define R123_USE_SSE 0
 
102
#endif
 
103
#endif
 
104
 
 
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
 
110
   play with openssl */
 
111
#define R123_USE_AES_OPENSSL 0
 
112
#endif
 
113
 
 
114
#ifndef R123_USE_GNU_UINT128
 
115
#define R123_USE_GNU_UINT128 0
 
116
#endif
 
117
 
 
118
#ifndef R123_USE_ASM_GNU
 
119
#define R123_USE_ASM_GNU 1
 
120
#endif
 
121
 
 
122
#ifndef R123_USE_CPUID_MSVC
 
123
#define R123_USE_CPUID_MSVC 0
 
124
#endif
 
125
 
 
126
#ifndef R123_USE_X86INTRIN_H
 
127
#define R123_USE_X86INTRIN_H 0
 
128
#endif
 
129
 
 
130
#ifndef R123_USE_IA32INTRIN_H
 
131
#define R123_USE_IA32INTRIN_H 0
 
132
#endif
 
133
 
 
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
 
138
#endif
 
139
 
 
140
#ifndef R123_USE_EMMINTRIN_H
 
141
#define R123_USE_EMMINTRIN_H 1
 
142
#endif
 
143
 
 
144
#ifndef R123_USE_SMMINTRIN_H
 
145
#define R123_USE_SMMINTRIN_H 0
 
146
#endif
 
147
 
 
148
#ifndef R123_USE_WMMINTRIN_H
 
149
#define R123_USE_WMMINTRIN_H 0
 
150
#endif
 
151
 
 
152
#ifndef R123_USE_INTRIN_H
 
153
#ifdef __ABM__
 
154
#define R123_USE_INTRIN_H 1
 
155
#else
 
156
#define R123_USE_INTRIN_H 0
 
157
#endif
 
158
#endif
 
159
 
 
160
#ifndef R123_USE_MULHILO32_ASM
 
161
#define R123_USE_MULHILO32_ASM 0
 
162
#endif
 
163
 
 
164
#ifndef R123_USE_MULHILO64_MULHI_INTRIN
 
165
#define R123_USE_MULHILO64_MULHI_INTRIN 0
 
166
#endif
 
167
 
 
168
#ifndef R123_USE_MULHILO64_ASM
 
169
#define R123_USE_MULHILO64_ASM 1
 
170
#endif
 
171
 
 
172
#ifndef R123_USE_MULHILO64_MSVC_INTRIN
 
173
#define R123_USE_MULHILO64_MSVC_INTRIN 0
 
174
#endif
 
175
 
 
176
#ifndef R123_USE_MULHILO64_CUDA_INTRIN
 
177
#define R123_USE_MULHILO64_CUDA_INTRIN 0
 
178
#endif
 
179
 
 
180
#ifndef R123_USE_MULHILO64_OPENCL_INTRIN
 
181
#define R123_USE_MULHILO64_OPENCL_INTRIN 0
 
182
#endif
 
183
 
 
184
#ifndef __STDC_CONSTANT_MACROS
 
185
#define __STDC_CONSTANT_MACROS
 
186
#endif
 
187
#include <stdint.h>
 
188
#ifndef UINT64_C
 
189
#error UINT64_C not defined.  You must define __STDC_CONSTANT_MACROS before you #include <stdint.h>
 
190
#endif
 
191
 
 
192
/* If you add something, it must go in all the other XXfeatures.hpp
 
193
   and in ../ut_features.cpp */
 
194
#endif