Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxx / include / __algorithm / pstl_backends / cpu_backends / serial.h
blobafcc7ffb2661304b5516eb7dcc25a9bb645c145a
1 // -*- C++ -*-
2 //===----------------------------------------------------------------------===//
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 _LIBCPP___ALGORITHM_PSTL_BACKENDS_CPU_BACKENDS_SERIAL_H
11 #define _LIBCPP___ALGORITHM_PSTL_BACKENDS_CPU_BACKENDS_SERIAL_H
13 #include <__config>
14 #include <__utility/empty.h>
15 #include <__utility/move.h>
16 #include <cstddef>
17 #include <optional>
19 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
20 # pragma GCC system_header
21 #endif
23 #if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
25 _LIBCPP_PUSH_MACROS
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) {
36 __f(__first, __last);
37 return __empty{};
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);
50 return __empty{};
53 _LIBCPP_HIDE_FROM_ABI inline void __cancel_execution() {}
55 template <class _RandomAccessIterator1,
56 class _RandomAccessIterator2,
57 class _RandomAccessIterator3,
58 class _Compare,
59 class _LeafMerge>
60 _LIBCPP_HIDE_FROM_ABI optional<__empty> __parallel_merge(
61 _RandomAccessIterator1 __first1,
62 _RandomAccessIterator1 __last1,
63 _RandomAccessIterator2 __first2,
64 _RandomAccessIterator2 __last2,
65 _RandomAccessIterator3 __outit,
66 _Compare __comp,
67 _LeafMerge __leaf_merge) {
68 __leaf_merge(__first1, __last1, __first2, __last2, __outit, __comp);
69 return __empty{};
72 // TODO: Complete this list
74 } // namespace __serial_cpu_backend
75 } // namespace __par_backend
77 _LIBCPP_END_NAMESPACE_STD
79 _LIBCPP_POP_MACROS
81 #endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && && _LIBCPP_STD_VER >= 17
83 #endif // _LIBCPP___ALGORITHM_PSTL_BACKENDS_CPU_BACKENDS_SERIAL_H