2 //===----------------------------------------------------------------------===//
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
8 //===----------------------------------------------------------------------===//
10 #ifndef _LIBCPP___ALGORITHM_PSTL_BACKENDS_CPU_BACKENDS_SERIAL_H
11 #define _LIBCPP___ALGORITHM_PSTL_BACKENDS_CPU_BACKENDS_SERIAL_H
14 #include <__utility/empty.h>
15 #include <__utility/move.h>
19 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
20 # pragma GCC system_header
23 #if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
26 # include <__undef_macros>
28 _LIBCPP_BEGIN_NAMESPACE_STD
30 namespace __par_backend
{
31 inline namespace __serial_cpu_backend
{
33 template <class _RandomAccessIterator
, class _Fp
>
34 _LIBCPP_HIDE_FROM_ABI optional
<__empty
>
35 __parallel_for(_RandomAccessIterator __first
, _RandomAccessIterator __last
, _Fp __f
) {
40 template <class _Index
, class _UnaryOp
, class _Tp
, class _BinaryOp
, class _Reduce
>
41 _LIBCPP_HIDE_FROM_ABI optional
<_Tp
>
42 __parallel_transform_reduce(_Index __first
, _Index __last
, _UnaryOp
, _Tp __init
, _BinaryOp
, _Reduce __reduce
) {
43 return __reduce(std::move(__first
), std::move(__last
), std::move(__init
));
46 template <class _RandomAccessIterator
, class _Compare
, class _LeafSort
>
47 _LIBCPP_HIDE_FROM_ABI optional
<__empty
> __parallel_stable_sort(
48 _RandomAccessIterator __first
, _RandomAccessIterator __last
, _Compare __comp
, _LeafSort __leaf_sort
) {
49 __leaf_sort(__first
, __last
, __comp
);
53 _LIBCPP_HIDE_FROM_ABI
inline void __cancel_execution() {}
55 template <class _RandomAccessIterator1
,
56 class _RandomAccessIterator2
,
57 class _RandomAccessIterator3
,
60 _LIBCPP_HIDE_FROM_ABI optional
<__empty
> __parallel_merge(
61 _RandomAccessIterator1 __first1
,
62 _RandomAccessIterator1 __last1
,
63 _RandomAccessIterator2 __first2
,
64 _RandomAccessIterator2 __last2
,
65 _RandomAccessIterator3 __outit
,
67 _LeafMerge __leaf_merge
) {
68 __leaf_merge(__first1
, __last1
, __first2
, __last2
, __outit
, __comp
);
72 // TODO: Complete this list
74 } // namespace __serial_cpu_backend
75 } // namespace __par_backend
77 _LIBCPP_END_NAMESPACE_STD
81 #endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && && _LIBCPP_STD_VER >= 17
83 #endif // _LIBCPP___ALGORITHM_PSTL_BACKENDS_CPU_BACKENDS_SERIAL_H