diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt --- a/libcxx/include/CMakeLists.txt +++ b/libcxx/include/CMakeLists.txt @@ -533,7 +533,6 @@ __pstl/internal/parallel_backend_tbb.h __pstl/internal/parallel_backend_utils.h __pstl/internal/parallel_impl.h - __pstl/internal/pstl_config.h __pstl/internal/unseq_backend_simd.h __pstl/internal/utils.h __pstl_algorithm diff --git a/libcxx/include/__config b/libcxx/include/__config --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -1271,6 +1271,46 @@ # define _LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS # endif +// TODO: Make this a proper configuration option +#define _PSTL_PAR_BACKEND_SERIAL + +#define _PSTL_PRAGMA(x) _Pragma(# x) + +// Enable SIMD for compilers that support OpenMP 4.0 +#if (defined(_OPENMP) && _OPENMP >= 201307) + +# define _PSTL_UDR_PRESENT +# define _PSTL_PRAGMA_SIMD _PSTL_PRAGMA(omp simd) +# define _PSTL_PRAGMA_DECLARE_SIMD _PSTL_PRAGMA(omp declare simd) +# define _PSTL_PRAGMA_SIMD_REDUCTION(PRM) _PSTL_PRAGMA(omp simd reduction(PRM)) +# define _PSTL_PRAGMA_SIMD_SCAN(PRM) _PSTL_PRAGMA(omp simd reduction(inscan, PRM)) +# define _PSTL_PRAGMA_SIMD_INCLUSIVE_SCAN(PRM) _PSTL_PRAGMA(omp scan inclusive(PRM)) +# define _PSTL_PRAGMA_SIMD_EXCLUSIVE_SCAN(PRM) _PSTL_PRAGMA(omp scan exclusive(PRM)) + +// Declaration of reduction functor, where +// NAME - the name of the functor +// OP - type of the callable object with the reduction operation +// omp_in - refers to the local partial result +// omp_out - refers to the final value of the combiner operator +// omp_priv - refers to the private copy of the initial value +// omp_orig - refers to the original variable to be reduced +# define _PSTL_PRAGMA_DECLARE_REDUCTION(NAME, OP) \ + _PSTL_PRAGMA(omp declare reduction(NAME:OP : omp_out(omp_in)) initializer(omp_priv = omp_orig)) + +#else // (defined(_OPENMP) && _OPENMP >= 201307) + +# define _PSTL_PRAGMA_SIMD +# define _PSTL_PRAGMA_DECLARE_SIMD +# define _PSTL_PRAGMA_SIMD_REDUCTION(PRM) +# define _PSTL_PRAGMA_SIMD_SCAN(PRM) +# define _PSTL_PRAGMA_SIMD_INCLUSIVE_SCAN(PRM) +# define _PSTL_PRAGMA_SIMD_EXCLUSIVE_SCAN(PRM) +# define _PSTL_PRAGMA_DECLARE_REDUCTION(NAME, OP) + +#endif // (defined(_OPENMP) && _OPENMP >= 201307) + +#define _PSTL_USE_NONTEMPORAL_STORES_IF_ALLOWED + #endif // __cplusplus #endif // _LIBCPP___CONFIG diff --git a/libcxx/include/__pstl/internal/algorithm_fwd.h b/libcxx/include/__pstl/internal/algorithm_fwd.h --- a/libcxx/include/__pstl/internal/algorithm_fwd.h +++ b/libcxx/include/__pstl/internal/algorithm_fwd.h @@ -10,12 +10,11 @@ #ifndef _PSTL_ALGORITHM_FWD_H #define _PSTL_ALGORITHM_FWD_H +#include <__config> #include #include #include -#include "pstl_config.h" - namespace __pstl { namespace __internal { diff --git a/libcxx/include/__pstl/internal/algorithm_impl.h b/libcxx/include/__pstl/internal/algorithm_impl.h --- a/libcxx/include/__pstl/internal/algorithm_impl.h +++ b/libcxx/include/__pstl/internal/algorithm_impl.h @@ -11,6 +11,7 @@ #define _PSTL_ALGORITHM_IMPL_H #include <__assert> +#include <__config> #include #include #include @@ -22,7 +23,6 @@ #include "parallel_backend.h" #include "parallel_backend_utils.h" #include "parallel_impl.h" -#include "pstl_config.h" #include "unseq_backend_simd.h" namespace __pstl { diff --git a/libcxx/include/__pstl/internal/execution_defs.h b/libcxx/include/__pstl/internal/execution_defs.h --- a/libcxx/include/__pstl/internal/execution_defs.h +++ b/libcxx/include/__pstl/internal/execution_defs.h @@ -10,12 +10,11 @@ #ifndef _PSTL_EXECUTION_POLICY_DEFS_H #define _PSTL_EXECUTION_POLICY_DEFS_H +#include <__config> #include <__type_traits/decay.h> #include <__type_traits/enable_if.h> #include <__type_traits/integral_constant.h> -#include "pstl_config.h" - #if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 namespace __pstl { diff --git a/libcxx/include/__pstl/internal/execution_impl.h b/libcxx/include/__pstl/internal/execution_impl.h --- a/libcxx/include/__pstl/internal/execution_impl.h +++ b/libcxx/include/__pstl/internal/execution_impl.h @@ -10,13 +10,13 @@ #ifndef _PSTL_EXECUTION_IMPL_H #define _PSTL_EXECUTION_IMPL_H +#include <__config> #include <__iterator/iterator_traits.h> #include <__type_traits/conditional.h> #include <__type_traits/conjunction.h> #include <__type_traits/is_base_of.h> #include "execution_defs.h" -#include "pstl_config.h" #if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 diff --git a/libcxx/include/__pstl/internal/glue_algorithm_defs.h b/libcxx/include/__pstl/internal/glue_algorithm_defs.h --- a/libcxx/include/__pstl/internal/glue_algorithm_defs.h +++ b/libcxx/include/__pstl/internal/glue_algorithm_defs.h @@ -10,11 +10,11 @@ #ifndef _PSTL_GLUE_ALGORITHM_DEFS_H #define _PSTL_GLUE_ALGORITHM_DEFS_H +#include <__config> #include #include #include "execution_defs.h" -#include "pstl_config.h" namespace std { diff --git a/libcxx/include/__pstl/internal/glue_algorithm_impl.h b/libcxx/include/__pstl/internal/glue_algorithm_impl.h --- a/libcxx/include/__pstl/internal/glue_algorithm_impl.h +++ b/libcxx/include/__pstl/internal/glue_algorithm_impl.h @@ -10,10 +10,9 @@ #ifndef _PSTL_GLUE_ALGORITHM_IMPL_H #define _PSTL_GLUE_ALGORITHM_IMPL_H +#include <__config> #include -#include "pstl_config.h" - #include "algorithm_fwd.h" #include "execution_defs.h" #include "numeric_fwd.h" /* count and count_if use __pattern_transform_reduce */ diff --git a/libcxx/include/__pstl/internal/glue_memory_defs.h b/libcxx/include/__pstl/internal/glue_memory_defs.h --- a/libcxx/include/__pstl/internal/glue_memory_defs.h +++ b/libcxx/include/__pstl/internal/glue_memory_defs.h @@ -10,8 +10,9 @@ #ifndef _PSTL_GLUE_MEMORY_DEFS_H #define _PSTL_GLUE_MEMORY_DEFS_H +#include <__config> + #include "execution_defs.h" -#include "pstl_config.h" namespace std { diff --git a/libcxx/include/__pstl/internal/glue_memory_impl.h b/libcxx/include/__pstl/internal/glue_memory_impl.h --- a/libcxx/include/__pstl/internal/glue_memory_impl.h +++ b/libcxx/include/__pstl/internal/glue_memory_impl.h @@ -10,7 +10,7 @@ #ifndef _PSTL_GLUE_MEMORY_IMPL_H #define _PSTL_GLUE_MEMORY_IMPL_H -#include "pstl_config.h" +#include <__config> #include "algorithm_fwd.h" #include "execution_defs.h" diff --git a/libcxx/include/__pstl/internal/glue_numeric_defs.h b/libcxx/include/__pstl/internal/glue_numeric_defs.h --- a/libcxx/include/__pstl/internal/glue_numeric_defs.h +++ b/libcxx/include/__pstl/internal/glue_numeric_defs.h @@ -10,10 +10,10 @@ #ifndef _PSTL_GLUE_NUMERIC_DEFS_H #define _PSTL_GLUE_NUMERIC_DEFS_H +#include <__config> #include #include "execution_defs.h" -#include "pstl_config.h" namespace std { // [reduce] diff --git a/libcxx/include/__pstl/internal/glue_numeric_impl.h b/libcxx/include/__pstl/internal/glue_numeric_impl.h --- a/libcxx/include/__pstl/internal/glue_numeric_impl.h +++ b/libcxx/include/__pstl/internal/glue_numeric_impl.h @@ -10,10 +10,9 @@ #ifndef _PSTL_GLUE_NUMERIC_IMPL_H #define _PSTL_GLUE_NUMERIC_IMPL_H +#include <__config> #include -#include "pstl_config.h" - #include "execution_impl.h" #include "numeric_fwd.h" #include "utils.h" diff --git a/libcxx/include/__pstl/internal/memory_impl.h b/libcxx/include/__pstl/internal/memory_impl.h --- a/libcxx/include/__pstl/internal/memory_impl.h +++ b/libcxx/include/__pstl/internal/memory_impl.h @@ -10,9 +10,9 @@ #ifndef _PSTL_MEMORY_IMPL_H #define _PSTL_MEMORY_IMPL_H +#include <__config> #include -#include "pstl_config.h" #include "unseq_backend_simd.h" namespace __pstl { diff --git a/libcxx/include/__pstl/internal/numeric_fwd.h b/libcxx/include/__pstl/internal/numeric_fwd.h --- a/libcxx/include/__pstl/internal/numeric_fwd.h +++ b/libcxx/include/__pstl/internal/numeric_fwd.h @@ -10,11 +10,10 @@ #ifndef _PSTL_NUMERIC_FWD_H #define _PSTL_NUMERIC_FWD_H +#include <__config> #include #include -#include "pstl_config.h" - namespace __pstl { namespace __internal { diff --git a/libcxx/include/__pstl/internal/numeric_impl.h b/libcxx/include/__pstl/internal/numeric_impl.h --- a/libcxx/include/__pstl/internal/numeric_impl.h +++ b/libcxx/include/__pstl/internal/numeric_impl.h @@ -11,12 +11,12 @@ #define _PSTL_NUMERIC_IMPL_H #include <__assert> +#include <__config> #include #include #include #include "parallel_backend.h" -#include "pstl_config.h" #include "execution_impl.h" #include "unseq_backend_simd.h" #include "algorithm_fwd.h" diff --git a/libcxx/include/__pstl/internal/parallel_backend.h b/libcxx/include/__pstl/internal/parallel_backend.h --- a/libcxx/include/__pstl/internal/parallel_backend.h +++ b/libcxx/include/__pstl/internal/parallel_backend.h @@ -10,7 +10,7 @@ #ifndef _PSTL_PARALLEL_BACKEND_H #define _PSTL_PARALLEL_BACKEND_H -#include "pstl_config.h" +#include <__config> #if defined(_PSTL_PAR_BACKEND_SERIAL) # include "parallel_backend_serial.h" diff --git a/libcxx/include/__pstl/internal/parallel_backend_serial.h b/libcxx/include/__pstl/internal/parallel_backend_serial.h --- a/libcxx/include/__pstl/internal/parallel_backend_serial.h +++ b/libcxx/include/__pstl/internal/parallel_backend_serial.h @@ -10,12 +10,11 @@ #ifndef _PSTL_PARALLEL_BACKEND_SERIAL_H #define _PSTL_PARALLEL_BACKEND_SERIAL_H +#include <__config> #include <__memory/allocator.h> #include <__pstl/internal/execution_impl.h> #include <__utility/forward.h> -#include "pstl_config.h" - #if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 namespace __pstl diff --git a/libcxx/include/__pstl/internal/parallel_backend_tbb.h b/libcxx/include/__pstl/internal/parallel_backend_tbb.h --- a/libcxx/include/__pstl/internal/parallel_backend_tbb.h +++ b/libcxx/include/__pstl/internal/parallel_backend_tbb.h @@ -11,10 +11,10 @@ #define _PSTL_PARALLEL_BACKEND_TBB_H #include <__assert> +#include <__config> #include #include -#include "pstl_config.h" #include "parallel_backend_utils.h" // Bring in minimal required subset of Intel TBB diff --git a/libcxx/include/__pstl/internal/parallel_backend_utils.h b/libcxx/include/__pstl/internal/parallel_backend_utils.h --- a/libcxx/include/__pstl/internal/parallel_backend_utils.h +++ b/libcxx/include/__pstl/internal/parallel_backend_utils.h @@ -11,13 +11,12 @@ #define _PSTL_PARALLEL_BACKEND_UTILS_H #include <__assert> +#include <__config> #include <__iterator/iterator_traits.h> #include <__memory/addressof.h> #include "utils.h" -#include "pstl_config.h" - namespace __pstl { diff --git a/libcxx/include/__pstl/internal/parallel_impl.h b/libcxx/include/__pstl/internal/parallel_impl.h --- a/libcxx/include/__pstl/internal/parallel_impl.h +++ b/libcxx/include/__pstl/internal/parallel_impl.h @@ -10,10 +10,9 @@ #ifndef _PSTL_PARALLEL_IMPL_H #define _PSTL_PARALLEL_IMPL_H -#include "pstl_config.h" - #include <__atomic/atomic.h> #include <__atomic/memory_order.h> +#include <__config> #include <__pstl/internal/parallel_backend.h> #if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 diff --git a/libcxx/include/__pstl/internal/pstl_config.h b/libcxx/include/__pstl/internal/pstl_config.h deleted file mode 100644 --- a/libcxx/include/__pstl/internal/pstl_config.h +++ /dev/null @@ -1,55 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _PSTL_CONFIG_H -#define _PSTL_CONFIG_H - -#include <__config> - -// TODO: Make this a proper configuration option -#define _PSTL_PAR_BACKEND_SERIAL - -#define _PSTL_PRAGMA(x) _Pragma(# x) - -// Enable SIMD for compilers that support OpenMP 4.0 -#if (defined(_OPENMP) && _OPENMP >= 201307) - -# define _PSTL_UDR_PRESENT -# define _PSTL_PRAGMA_SIMD _PSTL_PRAGMA(omp simd) -# define _PSTL_PRAGMA_DECLARE_SIMD _PSTL_PRAGMA(omp declare simd) -# define _PSTL_PRAGMA_SIMD_REDUCTION(PRM) _PSTL_PRAGMA(omp simd reduction(PRM)) -# define _PSTL_PRAGMA_SIMD_SCAN(PRM) _PSTL_PRAGMA(omp simd reduction(inscan, PRM)) -# define _PSTL_PRAGMA_SIMD_INCLUSIVE_SCAN(PRM) _PSTL_PRAGMA(omp scan inclusive(PRM)) -# define _PSTL_PRAGMA_SIMD_EXCLUSIVE_SCAN(PRM) _PSTL_PRAGMA(omp scan exclusive(PRM)) - -// Declaration of reduction functor, where -// NAME - the name of the functor -// OP - type of the callable object with the reduction operation -// omp_in - refers to the local partial result -// omp_out - refers to the final value of the combiner operator -// omp_priv - refers to the private copy of the initial value -// omp_orig - refers to the original variable to be reduced -# define _PSTL_PRAGMA_DECLARE_REDUCTION(NAME, OP) \ - _PSTL_PRAGMA(omp declare reduction(NAME:OP : omp_out(omp_in)) initializer(omp_priv = omp_orig)) - -#else // (defined(_OPENMP) && _OPENMP >= 201307) - -# define _PSTL_PRAGMA_SIMD -# define _PSTL_PRAGMA_DECLARE_SIMD -# define _PSTL_PRAGMA_SIMD_REDUCTION(PRM) -# define _PSTL_PRAGMA_SIMD_SCAN(PRM) -# define _PSTL_PRAGMA_SIMD_INCLUSIVE_SCAN(PRM) -# define _PSTL_PRAGMA_SIMD_EXCLUSIVE_SCAN(PRM) -# define _PSTL_PRAGMA_DECLARE_REDUCTION(NAME, OP) - -#endif // (defined(_OPENMP) && _OPENMP >= 201307) - -#define _PSTL_USE_NONTEMPORAL_STORES_IF_ALLOWED - -#endif /* _PSTL_CONFIG_H */ diff --git a/libcxx/include/__pstl/internal/unseq_backend_simd.h b/libcxx/include/__pstl/internal/unseq_backend_simd.h --- a/libcxx/include/__pstl/internal/unseq_backend_simd.h +++ b/libcxx/include/__pstl/internal/unseq_backend_simd.h @@ -10,13 +10,13 @@ #ifndef _PSTL_UNSEQ_BACKEND_SIMD_H #define _PSTL_UNSEQ_BACKEND_SIMD_H +#include <__config> #include <__functional/operations.h> #include <__type_traits/is_arithmetic.h> #include <__utility/pair.h> #include #include -#include "pstl_config.h" #include "utils.h" // This header defines the minimum set of vector routines required diff --git a/libcxx/include/__pstl/internal/utils.h b/libcxx/include/__pstl/internal/utils.h --- a/libcxx/include/__pstl/internal/utils.h +++ b/libcxx/include/__pstl/internal/utils.h @@ -10,8 +10,8 @@ #ifndef _PSTL_UTILS_H #define _PSTL_UTILS_H +#include <__config> #include <__exception/terminate.h> -#include <__pstl/internal/pstl_config.h> #include <__utility/forward.h> #include diff --git a/libcxx/utils/data/ignore_format.txt b/libcxx/utils/data/ignore_format.txt --- a/libcxx/utils/data/ignore_format.txt +++ b/libcxx/utils/data/ignore_format.txt @@ -523,7 +523,6 @@ libcxx/include/__pstl/internal/parallel_backend_tbb.h libcxx/include/__pstl/internal/parallel_backend_utils.h libcxx/include/__pstl/internal/parallel_impl.h -libcxx/include/__pstl/internal/pstl_config.h libcxx/include/__pstl/internal/unseq_backend_simd.h libcxx/include/__pstl/internal/utils.h libcxx/include/queue