MCKL
Monte Carlo Kernel Library
include
mckl
internal
compiler
gcc.h
Go to the documentation of this file.
1
//============================================================================
2
// MCKL/include/mckl/internal/compiler/gcc.h
3
//----------------------------------------------------------------------------
4
// MCKL: Monte Carlo Kernel Library
5
//----------------------------------------------------------------------------
6
// Copyright (c) 2013-2018, Yan Zhou
7
// All rights reserved.
8
//
9
// Redistribution and use in source and binary forms, with or without
10
// modification, are permitted provided that the following conditions are met:
11
//
12
// Redistributions of source code must retain the above copyright notice,
13
// this list of conditions and the following disclaimer.
14
//
15
// Redistributions in binary form must reproduce the above copyright notice,
16
// this list of conditions and the following disclaimer in the documentation
17
// and/or other materials provided with the distribution.
18
//
19
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS
20
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
// POSSIBILITY OF SUCH DAMAGE.
30
//============================================================================
31
32
#ifndef MCKL_INTERNAL_COMPILER_GCC_H
33
#define MCKL_INTERNAL_COMPILER_GCC_H
34
35
#if MCKL_HAS_X86
36
#include <x86intrin.h>
37
#endif
38
39
#define MCKL_GCC_VERSION \
40
(__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
41
42
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
43
#ifndef MCKL_HAS_LITTLE_ENDIAN
44
#define MCKL_HAS_LITTLE_ENDIAN 1
45
#endif
46
#endif
47
48
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
49
#ifndef MCKL_HAS_BIG_ENDIAN
50
#define MCKL_HAS_BIG_ENDIAN 1
51
#endif
52
#endif
53
54
#ifdef __SSE2__
55
#ifndef MCKL_HAS_SSE2
56
#define MCKL_HAS_SSE2 1
57
#endif
58
#endif
59
60
#ifdef __SSE3__
61
#ifndef MCKL_HAS_SSE3
62
#define MCKL_HAS_SSE3 1
63
#endif
64
#endif
65
66
#ifdef __SSSE3__
67
#ifndef MCKL_HAS_SSSE3
68
#define MCKL_HAS_SSSE3 1
69
#endif
70
#endif
71
72
#ifdef __SSE4_1__
73
#ifndef MCKL_HAS_SSE4_1
74
#define MCKL_HAS_SSE4_1 1
75
#endif
76
#endif
77
78
#ifdef __SSE4_2__
79
#ifndef MCKL_HAS_SSE4_2
80
#define MCKL_HAS_SSE4_2 1
81
#endif
82
#endif
83
84
#ifdef __AVX__
85
#ifndef MCKL_HAS_AVX
86
#define MCKL_HAS_AVX 1
87
#endif
88
#endif
89
90
#ifdef __AVX2__
91
#ifndef MCKL_HAS_AVX2
92
#define MCKL_HAS_AVX2 1
93
#endif
94
#endif
95
96
#if defined(__AVX512BW__) && defined(__AVX512CD__) && \
97
defined(__AVX512DQ__) && defined(__AVX512F__) && defined(__AVX512VL__)
98
#ifndef MCKL_HAS_AVX512
99
#define MCKL_HAS_AVX512 1
100
#endif
101
#endif
102
103
#ifdef __AES__
104
#ifndef MCKL_HAS_AESNI
105
#define MCKL_HAS_AESNI 1
106
#endif
107
#endif
108
109
#ifdef __RDRND__
110
#ifndef MCKL_HAS_RDRAND
111
#define MCKL_HAS_RDRAND 1
112
#endif
113
#endif
114
115
#ifdef __BMI__
116
#ifndef MCKL_HAS_BMI
117
#define MCKL_HAS_BMI 1
118
#endif
119
#endif
120
121
#ifdef __BMI2__
122
#ifndef MCKL_HAS_BMI2
123
#define MCKL_HAS_BMI2 1
124
#endif
125
#endif
126
127
#ifdef __FMA__
128
#ifndef MCKL_HAS_FMA
129
#define MCKL_HAS_FMA 1
130
#endif
131
#endif
132
133
#ifndef MCKL_INT64
134
#define MCKL_INT64 long long
135
#endif
136
137
#if MCKL_HAS_X86_64
138
#ifndef MCKL_HAS_INT128
139
#define MCKL_HAS_INT128 1
140
#endif
141
#ifndef MCKL_INT128
142
#define MCKL_INT128 __int128
143
#endif
144
#endif
145
146
#ifndef MCKL_INLINE
147
#define MCKL_INLINE __attribute__((always_inline, flatten))
148
#endif
149
150
#endif // MCKL_INTERNAL_COMPILER_GCC_H
Generated by
1.8.13