[libcxx-commits] [libcxx] 3f42fee - [libc++][NFC] Rename __simd_walk functions to give more descriptive names

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jun 12 09:28:27 PDT 2024


Author: Louis Dionne
Date: 2024-06-12T12:27:41-04:00
New Revision: 3f42fee6010ccd5ef3a3c2c2b3822133f8d29dfd

URL: https://github.com/llvm/llvm-project/commit/3f42fee6010ccd5ef3a3c2c2b3822133f8d29dfd
DIFF: https://github.com/llvm/llvm-project/commit/3f42fee6010ccd5ef3a3c2c2b3822133f8d29dfd.diff

LOG: [libc++][NFC] Rename __simd_walk functions to give more descriptive names

Added: 
    

Modified: 
    libcxx/include/__pstl/cpu_algos/for_each.h
    libcxx/include/__pstl/cpu_algos/transform.h

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__pstl/cpu_algos/for_each.h b/libcxx/include/__pstl/cpu_algos/for_each.h
index 9c49fb8432829..1e5677d998994 100644
--- a/libcxx/include/__pstl/cpu_algos/for_each.h
+++ b/libcxx/include/__pstl/cpu_algos/for_each.h
@@ -28,7 +28,7 @@
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 template <class _Iterator, class _DifferenceType, class _Function>
-_LIBCPP_HIDE_FROM_ABI _Iterator __simd_walk(_Iterator __first, _DifferenceType __n, _Function __f) noexcept {
+_LIBCPP_HIDE_FROM_ABI _Iterator __simd_for_each(_Iterator __first, _DifferenceType __n, _Function __f) noexcept {
   _PSTL_PRAGMA_SIMD
   for (_DifferenceType __i = 0; __i < __n; ++__i)
     __f(__first[__i]);
@@ -52,7 +52,7 @@ struct __cpu_parallel_for_each {
           });
     } else if constexpr (__is_unsequenced_execution_policy_v<_RawExecutionPolicy> &&
                          __has_random_access_iterator_category_or_concept<_ForwardIterator>::value) {
-      std::__simd_walk(__first, __last - __first, __func);
+      std::__simd_for_each(__first, __last - __first, __func);
       return __empty{};
     } else {
       std::for_each(__first, __last, __func);

diff  --git a/libcxx/include/__pstl/cpu_algos/transform.h b/libcxx/include/__pstl/cpu_algos/transform.h
index a4541fb22e8f6..440368d97f182 100644
--- a/libcxx/include/__pstl/cpu_algos/transform.h
+++ b/libcxx/include/__pstl/cpu_algos/transform.h
@@ -33,13 +33,22 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 
 template <class _Iterator1, class _DifferenceType, class _Iterator2, class _Function>
 _LIBCPP_HIDE_FROM_ABI _Iterator2
-__simd_walk(_Iterator1 __first1, _DifferenceType __n, _Iterator2 __first2, _Function __f) noexcept {
+__simd_transform(_Iterator1 __first1, _DifferenceType __n, _Iterator2 __first2, _Function __f) noexcept {
   _PSTL_PRAGMA_SIMD
   for (_DifferenceType __i = 0; __i < __n; ++__i)
     __f(__first1[__i], __first2[__i]);
   return __first2 + __n;
 }
 
+template <class _Iterator1, class _DifferenceType, class _Iterator2, class _Iterator3, class _Function>
+_LIBCPP_HIDE_FROM_ABI _Iterator3 __simd_transform(
+    _Iterator1 __first1, _DifferenceType __n, _Iterator2 __first2, _Iterator3 __first3, _Function __f) noexcept {
+  _PSTL_PRAGMA_SIMD
+  for (_DifferenceType __i = 0; __i < __n; ++__i)
+    __f(__first1[__i], __first2[__i], __first3[__i]);
+  return __first3 + __n;
+}
+
 template <class _Backend, class _RawExecutionPolicy>
 struct __cpu_parallel_transform {
   template <class _Policy, class _ForwardIterator, class _ForwardOutIterator, class _UnaryOperation>
@@ -70,7 +79,7 @@ struct __cpu_parallel_transform {
     } else if constexpr (__is_unsequenced_execution_policy_v<_RawExecutionPolicy> &&
                          __has_random_access_iterator_category_or_concept<_ForwardIterator>::value &&
                          __has_random_access_iterator_category_or_concept<_ForwardOutIterator>::value) {
-      return std::__simd_walk(
+      return std::__simd_transform(
           __first,
           __last - __first,
           __result,
@@ -83,15 +92,6 @@ struct __cpu_parallel_transform {
   }
 };
 
-template <class _Iterator1, class _DifferenceType, class _Iterator2, class _Iterator3, class _Function>
-_LIBCPP_HIDE_FROM_ABI _Iterator3 __simd_walk(
-    _Iterator1 __first1, _DifferenceType __n, _Iterator2 __first2, _Iterator3 __first3, _Function __f) noexcept {
-  _PSTL_PRAGMA_SIMD
-  for (_DifferenceType __i = 0; __i < __n; ++__i)
-    __f(__first1[__i], __first2[__i], __first3[__i]);
-  return __first3 + __n;
-}
-
 template <class _Backend, class _RawExecutionPolicy>
 struct __cpu_parallel_transform_binary {
   template <class _Policy,
@@ -132,7 +132,7 @@ struct __cpu_parallel_transform_binary {
                          __has_random_access_iterator_category_or_concept<_ForwardIterator1>::value &&
                          __has_random_access_iterator_category_or_concept<_ForwardIterator2>::value &&
                          __has_random_access_iterator_category_or_concept<_ForwardOutIterator>::value) {
-      return std::__simd_walk(
+      return std::__simd_transform(
           __first1,
           __last1 - __first1,
           __first2,


        


More information about the libcxx-commits mailing list