testsuite/111125 - disable BB vectorization for the test
[official-gcc.git] / libstdc++-v3 / include / pstl / pstl_config.h
blobccb9dd32838d3f32581d66035734f4cd9b4f931e
1 // -*- C++ -*-
2 //===-- pstl_config.h -----------------------------------------------------===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
10 #ifndef _PSTL_CONFIG_H
11 #define _PSTL_CONFIG_H
13 // The version is XYYZ, where X is major, YY is minor, and Z is patch (i.e. X.YY.Z)
14 #define _PSTL_VERSION 17000
15 #define _PSTL_VERSION_MAJOR (_PSTL_VERSION / 1000)
16 #define _PSTL_VERSION_MINOR ((_PSTL_VERSION % 1000) / 10)
17 #define _PSTL_VERSION_PATCH (_PSTL_VERSION % 10)
19 #if !defined(_PSTL_PAR_BACKEND_SERIAL) && !defined(_PSTL_PAR_BACKEND_TBB) && !defined(_PSTL_PAR_BACKEND_OPENMP)
20 # error "A parallel backend must be specified"
21 #endif
23 // Check the user-defined macro for warnings
24 #if defined(PSTL_USAGE_WARNINGS)
25 # undef _PSTL_USAGE_WARNINGS
26 # define _PSTL_USAGE_WARNINGS PSTL_USAGE_WARNINGS
27 // Check the internal macro for warnings
28 #elif !defined(_PSTL_USAGE_WARNINGS)
29 # define _PSTL_USAGE_WARNINGS 0
30 #endif
32 // Portability "#pragma" definition
33 #ifdef _MSC_VER
34 # define _PSTL_PRAGMA(x) __pragma(x)
35 #else
36 # define _PSTL_PRAGMA(x) _Pragma(# x)
37 #endif
39 #define _PSTL_STRING_AUX(x) #x
40 #define _PSTL_STRING(x) _PSTL_STRING_AUX(x)
41 #define _PSTL_STRING_CONCAT(x, y) x #y
43 #ifdef _PSTL_HIDE_FROM_ABI_PER_TU
44 # define _PSTL_HIDE_FROM_ABI_PUSH \
45 _Pragma("clang attribute push(__attribute__((internal_linkage)), apply_to=any(function,record))")
46 # define _PSTL_HIDE_FROM_ABI_POP _Pragma("clang attribute pop")
47 #else
48 # define _PSTL_HIDE_FROM_ABI_PUSH /* nothing */
49 # define _PSTL_HIDE_FROM_ABI_POP /* nothing */
50 #endif
52 // note that when ICC or Clang is in use, _PSTL_GCC_VERSION might not fully match
53 // the actual GCC version on the system.
54 #define _PSTL_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
56 #if defined(__clang__)
57 // according to clang documentation, version can be vendor specific
58 # define _PSTL_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
59 #endif
61 // Enable SIMD for compilers that support OpenMP 4.0
62 #if (defined(_OPENMP) && _OPENMP >= 201307) || \
63 (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1600) || \
64 (!defined(__INTEL_COMPILER) && _PSTL_GCC_VERSION >= 40900) || \
65 defined(__clang__)
66 # define _PSTL_PRAGMA_SIMD _PSTL_PRAGMA(omp simd)
67 # define _PSTL_PRAGMA_DECLARE_SIMD _PSTL_PRAGMA(omp declare simd)
68 # define _PSTL_PRAGMA_SIMD_REDUCTION(PRM) _PSTL_PRAGMA(omp simd reduction(PRM))
69 #elif !defined(_MSC_VER) //#pragma simd
70 # define _PSTL_PRAGMA_SIMD _PSTL_PRAGMA(simd)
71 # define _PSTL_PRAGMA_DECLARE_SIMD
72 # define _PSTL_PRAGMA_SIMD_REDUCTION(PRM) _PSTL_PRAGMA(simd reduction(PRM))
73 #else //no simd
74 # define _PSTL_PRAGMA_SIMD
75 # define _PSTL_PRAGMA_DECLARE_SIMD
76 # define _PSTL_PRAGMA_SIMD_REDUCTION(PRM)
77 #endif //Enable SIMD
79 #if defined(__INTEL_COMPILER)
80 # define _PSTL_PRAGMA_FORCEINLINE _PSTL_PRAGMA(forceinline)
81 #else
82 # define _PSTL_PRAGMA_FORCEINLINE
83 #endif
85 #if (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1900) || \
86 (!defined(__INTEL_COMPILER) && _PSTL_GCC_VERSION >= 100000)
87 # define _PSTL_PRAGMA_SIMD_SCAN(PRM) _PSTL_PRAGMA(omp simd reduction(inscan, PRM))
88 # define _PSTL_PRAGMA_SIMD_INCLUSIVE_SCAN(PRM) _PSTL_PRAGMA(omp scan inclusive(PRM))
89 # define _PSTL_PRAGMA_SIMD_EXCLUSIVE_SCAN(PRM) _PSTL_PRAGMA(omp scan exclusive(PRM))
90 #else
91 # define _PSTL_PRAGMA_SIMD_SCAN(PRM)
92 # define _PSTL_PRAGMA_SIMD_INCLUSIVE_SCAN(PRM)
93 # define _PSTL_PRAGMA_SIMD_EXCLUSIVE_SCAN(PRM)
94 #endif
96 // Should be defined to 1 for environments with a vendor implementation of C++17 execution policies
97 #define _PSTL_CPP17_EXECUTION_POLICIES_PRESENT (_MSC_VER >= 1912 && _MSVC_LANG >= 201703L) || \
98 (_GLIBCXX_RELEASE >= 9 && __GLIBCXX__ >= 20190503 && __cplusplus >= 201703L)
100 #if (defined(_MSC_VER) && _MSC_VER >= 1900) || \
101 __cplusplus >= 201300L || \
102 __cpp_lib_robust_nonmodifying_seq_ops == 201304
103 # define _PSTL_CPP14_2RANGE_MISMATCH_EQUAL_PRESENT
104 #endif
105 #if (defined(_MSC_VER) && _MSC_VER >= 1900) || \
106 __cplusplus >= 201402L || \
107 __cpp_lib_make_reverse_iterator == 201402
108 # define _PSTL_CPP14_MAKE_REVERSE_ITERATOR_PRESENT
109 #endif
110 #if (defined(_MSC_VER) && _MSC_VER >= 1900) || __cplusplus >= 201402L
111 # define _PSTL_CPP14_INTEGER_SEQUENCE_PRESENT
112 #endif
113 #if (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1700) || \
114 (defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 190023918) || \
115 __cplusplus >= 201402L
116 # define _PSTL_CPP14_VARIABLE_TEMPLATES_PRESENT
117 #endif
119 #if defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1800
120 # define _PSTL_EARLYEXIT_PRESENT
121 # define _PSTL_MONOTONIC_PRESENT
122 #endif
124 #if (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1900) || \
125 (!defined(__INTEL_COMPILER) && _PSTL_GCC_VERSION >= 40900) || \
126 (defined(_OPENMP) && _OPENMP >= 201307)
127 # define _PSTL_UDR_PRESENT
128 #endif
130 #if (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1900 && __INTEL_COMPILER_BUILD_DATE >= 20180626) || \
131 (!defined(__INTEL_COMPILER) && _PSTL_GCC_VERSION >= 100000)
132 # define _PSTL_UDS_PRESENT
133 #endif
135 #if defined(_PSTL_EARLYEXIT_PRESENT)
136 # define _PSTL_PRAGMA_SIMD_EARLYEXIT _PSTL_PRAGMA(omp simd early_exit)
137 #else
138 # define _PSTL_PRAGMA_SIMD_EARLYEXIT
139 #endif
141 #if defined(_PSTL_MONOTONIC_PRESENT)
142 # define _PSTL_PRAGMA_SIMD_ORDERED_MONOTONIC(PRM) _PSTL_PRAGMA(omp ordered simd monotonic(PRM))
143 # define _PSTL_PRAGMA_SIMD_ORDERED_MONOTONIC_2ARGS(PRM1, PRM2) _PSTL_PRAGMA(omp ordered simd monotonic(PRM1, PRM2))
144 #else
145 # define _PSTL_PRAGMA_SIMD_ORDERED_MONOTONIC(PRM)
146 # define _PSTL_PRAGMA_SIMD_ORDERED_MONOTONIC_2ARGS(PRM1, PRM2)
147 #endif
149 // Declaration of reduction functor, where
150 // NAME - the name of the functor
151 // OP - type of the callable object with the reduction operation
152 // omp_in - refers to the local partial result
153 // omp_out - refers to the final value of the combiner operator
154 // omp_priv - refers to the private copy of the initial value
155 // omp_orig - refers to the original variable to be reduced
156 #define _PSTL_PRAGMA_DECLARE_REDUCTION(NAME, OP) \
157 _PSTL_PRAGMA(omp declare reduction(NAME:OP : omp_out(omp_in)) initializer(omp_priv = omp_orig))
159 #if defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1600
160 # define _PSTL_PRAGMA_VECTOR_UNALIGNED _PSTL_PRAGMA(vector unaligned)
161 #else
162 # define _PSTL_PRAGMA_VECTOR_UNALIGNED
163 #endif
165 // Check the user-defined macro to use non-temporal stores
166 #if defined(PSTL_USE_NONTEMPORAL_STORES) && (__INTEL_COMPILER >= 1600)
167 # define _PSTL_USE_NONTEMPORAL_STORES_IF_ALLOWED _PSTL_PRAGMA(vector nontemporal)
168 #else
169 # define _PSTL_USE_NONTEMPORAL_STORES_IF_ALLOWED
170 #endif
172 #if defined(_MSC_VER) || defined(__INTEL_COMPILER) // the preprocessors don't type a message location
173 # define _PSTL_PRAGMA_LOCATION __FILE__ ":" _PSTL_STRING(__LINE__) ": [Parallel STL message]: "
174 #else
175 # define _PSTL_PRAGMA_LOCATION " [Parallel STL message]: "
176 #endif
178 #define _PSTL_PRAGMA_MESSAGE_IMPL(x) _PSTL_PRAGMA(message(_PSTL_STRING_CONCAT(_PSTL_PRAGMA_LOCATION, x)))
180 #if defined(_PSTL_USAGE_WARNINGS)
181 # define _PSTL_PRAGMA_MESSAGE(x) _PSTL_PRAGMA_MESSAGE_IMPL(x)
182 # define _PSTL_PRAGMA_MESSAGE_POLICIES(x) _PSTL_PRAGMA_MESSAGE_IMPL(x)
183 #else
184 # define _PSTL_PRAGMA_MESSAGE(x)
185 # define _PSTL_PRAGMA_MESSAGE_POLICIES(x)
186 #endif
188 // broken macros
189 #if (defined(__GLIBCXX__) && __GLIBCXX__ < 20150716) || \
190 (defined(_MSC_VER) && _MSC_VER < 1800)
191 # define _PSTL_CPP11_STD_ROTATE_BROKEN
192 #endif
194 #if defined(__INTEL_COMPILER) && __INTEL_COMPILER == 1800
195 # define _PSTL_ICC_18_OMP_SIMD_BROKEN
196 #endif
198 #endif /* _PSTL_CONFIG_H */