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