Skip to content

Commit f2b79ed

Browse files
authored
[libcxx] Refactoring SIMD function names in PSTL CPU backend (#69029)
This PR addresses a smaller detail discussed in the code review for #66968. Currently, some functions in the `libc++` PSTL CPU backend have been appended with a digit to indicate the number of input iterator arguments. However, there is no need to change the name for each version as overloading can be used instead. This PR will make the naming more consistent in the the CPU and the proposed OpenMP backend.
1 parent 25d93f3 commit f2b79ed

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

libcxx/include/__algorithm/pstl_backends/cpu_backends/for_each.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
_LIBCPP_BEGIN_NAMESPACE_STD
2727

2828
template <class _Iterator, class _DifferenceType, class _Function>
29-
_LIBCPP_HIDE_FROM_ABI _Iterator __simd_walk_1(_Iterator __first, _DifferenceType __n, _Function __f) noexcept {
29+
_LIBCPP_HIDE_FROM_ABI _Iterator __simd_walk(_Iterator __first, _DifferenceType __n, _Function __f) noexcept {
3030
_PSTL_PRAGMA_SIMD
3131
for (_DifferenceType __i = 0; __i < __n; ++__i)
3232
__f(__first[__i]);
@@ -47,7 +47,7 @@ __pstl_for_each(__cpu_backend_tag, _ForwardIterator __first, _ForwardIterator __
4747
});
4848
} else if constexpr (__is_unsequenced_execution_policy_v<_ExecutionPolicy> &&
4949
__has_random_access_iterator_category_or_concept<_ForwardIterator>::value) {
50-
std::__simd_walk_1(__first, __last - __first, __func);
50+
std::__simd_walk(__first, __last - __first, __func);
5151
return __empty{};
5252
} else {
5353
std::for_each(__first, __last, __func);

libcxx/include/__algorithm/pstl_backends/cpu_backends/transform.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
3232

3333
template <class _Iterator1, class _DifferenceType, class _Iterator2, class _Function>
3434
_LIBCPP_HIDE_FROM_ABI _Iterator2
35-
__simd_walk_2(_Iterator1 __first1, _DifferenceType __n, _Iterator2 __first2, _Function __f) noexcept {
35+
__simd_walk(_Iterator1 __first1, _DifferenceType __n, _Iterator2 __first2, _Function __f) noexcept {
3636
_PSTL_PRAGMA_SIMD
3737
for (_DifferenceType __i = 0; __i < __n; ++__i)
3838
__f(__first1[__i], __first2[__i]);
@@ -60,7 +60,7 @@ _LIBCPP_HIDE_FROM_ABI optional<_ForwardOutIterator> __pstl_transform(
6060
} else if constexpr (__is_unsequenced_execution_policy_v<_ExecutionPolicy> &&
6161
__has_random_access_iterator_category_or_concept<_ForwardIterator>::value &&
6262
__has_random_access_iterator_category_or_concept<_ForwardOutIterator>::value) {
63-
return std::__simd_walk_2(
63+
return std::__simd_walk(
6464
__first,
6565
__last - __first,
6666
__result,
@@ -73,7 +73,7 @@ _LIBCPP_HIDE_FROM_ABI optional<_ForwardOutIterator> __pstl_transform(
7373
}
7474

7575
template <class _Iterator1, class _DifferenceType, class _Iterator2, class _Iterator3, class _Function>
76-
_LIBCPP_HIDE_FROM_ABI _Iterator3 __simd_walk_3(
76+
_LIBCPP_HIDE_FROM_ABI _Iterator3 __simd_walk(
7777
_Iterator1 __first1, _DifferenceType __n, _Iterator2 __first2, _Iterator3 __first3, _Function __f) noexcept {
7878
_PSTL_PRAGMA_SIMD
7979
for (_DifferenceType __i = 0; __i < __n; ++__i)
@@ -116,7 +116,7 @@ _LIBCPP_HIDE_FROM_ABI optional<_ForwardOutIterator> __pstl_transform(
116116
__has_random_access_iterator_category_or_concept<_ForwardIterator1>::value &&
117117
__has_random_access_iterator_category_or_concept<_ForwardIterator2>::value &&
118118
__has_random_access_iterator_category_or_concept<_ForwardOutIterator>::value) {
119-
return std::__simd_walk_3(
119+
return std::__simd_walk(
120120
__first1,
121121
__last1 - __first1,
122122
__first2,

0 commit comments

Comments
 (0)