Index: include/pstl/internal/algorithm_impl.h =================================================================== --- include/pstl/internal/algorithm_impl.h +++ include/pstl/internal/algorithm_impl.h @@ -47,7 +47,7 @@ __brick_any_of(const _ForwardIterator __first, const _ForwardIterator __last, _Pred __pred, /*__is_vector=*/std::true_type) noexcept { - return unseq_backend::simd_or(__first, __last - __first, __pred); + return __unseq_backend::__simd_or(__first, __last - __first, __pred); }; template @@ -102,7 +102,7 @@ __brick_walk1(_RandomAccessIterator __first, _RandomAccessIterator __last, _Function __f, /*vector=*/std::true_type) noexcept { - unseq_backend::simd_walk_1(__first, __last - __first, __f); + __unseq_backend::__simd_walk_1(__first, __last - __first, __f); } template @@ -167,7 +167,7 @@ __brick_walk1_n(_RandomAccessIterator __first, _DifferenceType __n, _Function __f, /*vectorTag=*/std::true_type) noexcept { - return unseq_backend::simd_walk_1(__first, __n, __f); + return __unseq_backend::__simd_walk_1(__first, __n, __f); } template @@ -233,7 +233,7 @@ __brick_walk2(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _Function __f, /*vector=*/std::true_type) noexcept { - return unseq_backend::simd_walk_2(__first1, __last1 - __first1, __first2, __f); + return __unseq_backend::__simd_walk_2(__first1, __last1 - __first1, __first2, __f); } template @@ -251,7 +251,7 @@ __brick_walk2_n(_ForwardIterator1 __first1, _Size __n, _ForwardIterator2 __first2, _Function __f, /*vector=*/std::true_type) noexcept { - return unseq_backend::simd_walk_2(__first1, __n, __first2, __f); + return __unseq_backend::__simd_walk_2(__first1, __n, __first2, __f); } template @@ -368,7 +368,7 @@ __brick_walk3(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1, _RandomAccessIterator2 __first2, _RandomAccessIterator3 __first3, _Function __f, /*vector=*/std::true_type) noexcept { - return unseq_backend::simd_walk_3(__first1, __last1 - __first1, __first2, __first3, __f); + return __unseq_backend::__simd_walk_3(__first1, __last1 - __first1, __first2, __first3, __f); } template (__p)).first == - __last1; + return __unseq_backend::__simd_first(__first1, __last1 - __first1, __first2, __not_pred<_BinaryPredicate>(__p)) + .first == __last1; } template ::difference_type _SizeType; - return unseq_backend::simd_first( + return __unseq_backend::__simd_first( __first, _SizeType(0), __last - __first, [&__pred](_RandomAccessIterator __it, _SizeType __i) { return __pred(__it[__i]); }); } @@ -664,7 +664,7 @@ __brick_find_first_of(_ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __s_first, _ForwardIterator2 __s_last, _BinaryPredicate __pred, /*__is_vector=*/std::true_type) noexcept { - return unseq_backend::simd_find_first_of(__first, __last, __s_first, __s_last, __pred); + return __unseq_backend::__simd_find_first_of(__first, __last, __s_first, __s_last, __pred); } template ); + return __unseq_backend::__simd_assign(__first, __last - __first, __result, + iter_swap<_ForwardIterator, _OutputIterator>); } //------------------------------------------------------------------------ @@ -912,7 +912,7 @@ /*vector=*/std::true_type) noexcept { #if (__PSTL_MONOTONIC_PRESENT) - return unseq_backend::simd_copy_if(__first, __last - __first, __result, __pred); + return __unseq_backend::__simd_copy_if(__first, __last - __first, __result, __pred); #else return std::copy_if(__first, __last, __result, __pred); #endif @@ -946,7 +946,7 @@ __brick_calc_mask_1(_RandomAccessIterator __first, _RandomAccessIterator __last, bool* __mask, _UnaryPredicate __pred, /*vector=*/std::true_type) noexcept { - auto __result = unseq_backend::simd_calc_mask_1(__first, __last - __first, __mask, __pred); + auto __result = __unseq_backend::__simd_calc_mask_1(__first, __last - __first, __mask, __pred); return std::make_pair(__result, (__last - __first) - __result); } @@ -971,7 +971,7 @@ bool* __restrict __mask, _Assigner __assigner, /*vector=*/std::true_type) noexcept { #if (__PSTL_MONOTONIC_PRESENT) - unseq_backend::simd_copy_by_mask(__first, __last - __first, __result, __mask, __assigner); + __unseq_backend::__simd_copy_by_mask(__first, __last - __first, __result, __mask, __assigner); #else __brick_copy_by_mask(__first, __last, __result, __mask, __assigner, std::false_type()); #endif @@ -1003,7 +1003,7 @@ _OutputIterator2 __out_false, bool* __mask, /*vector=*/std::true_type) noexcept { #if (__PSTL_MONOTONIC_PRESENT) - unseq_backend::simd_partition_by_mask(__first, __last - __first, __out_true, __out_false, __mask); + __unseq_backend::__simd_partition_by_mask(__first, __last - __first, __out_true, __out_false, __mask); #else __brick_partition_by_mask(__first, __last, __out_true, __out_false, __mask, std::false_type()); #endif @@ -1062,7 +1062,7 @@ __brick_count(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred, /* is_vector = */ std::true_type) noexcept { - return unseq_backend::simd_count(__first, __last - __first, __pred); + return __unseq_backend::__simd_count(__first, __last - __first, __pred); } template @@ -1253,7 +1253,7 @@ _BinaryPredicate __pred, /*vector=*/std::true_type) noexcept { #if (__PSTL_MONOTONIC_PRESENT) - return unseq_backend::simd_unique_copy(__first, __last - __first, __result, __pred); + return __unseq_backend::__simd_unique_copy(__first, __last - __first, __result, __pred); #else return std::unique_copy(__first, __last, __result, __pred); #endif @@ -1287,7 +1287,7 @@ __brick_calc_mask_2(_RandomAccessIterator __first, _RandomAccessIterator __last, bool* __restrict __mask, _BinaryPredicate __pred, /*vector=*/std::true_type) noexcept { - return unseq_backend::simd_calc_mask_2(__first, __last - __first, __mask, __pred); + return __unseq_backend::__simd_calc_mask_2(__first, __last - __first, __mask, __pred); } #if __PSTL_USE_PAR_POLICIES @@ -1359,11 +1359,11 @@ typedef typename std::iterator_traits<_BidirectionalIterator>::reference _ReferenceType; const auto __n = (__last - __first) / 2; - unseq_backend::simd_walk_2(__first, __n, std::reverse_iterator<_BidirectionalIterator>(__last), - [](_ReferenceType __x, _ReferenceType __y) { - using std::swap; - swap(__x, __y); - }); + __unseq_backend::__simd_walk_2(__first, __n, std::reverse_iterator<_BidirectionalIterator>(__last), + [](_ReferenceType __x, _ReferenceType __y) { + using std::swap; + swap(__x, __y); + }); } // this brick is called in parallel version, so we can use iterator arithmetic @@ -1387,11 +1387,11 @@ { typedef typename std::iterator_traits<_BidirectionalIterator>::reference _ReferenceType; - unseq_backend::simd_walk_2(__first, __last - __first, std::reverse_iterator<_BidirectionalIterator>(__d_last), - [](_ReferenceType __x, _ReferenceType __y) { - using std::swap; - swap(__x, __y); - }); + __unseq_backend::__simd_walk_2(__first, __last - __first, std::reverse_iterator<_BidirectionalIterator>(__d_last), + [](_ReferenceType __x, _ReferenceType __y) { + using std::swap; + swap(__x, __y); + }); } template @@ -1437,8 +1437,8 @@ typedef typename std::iterator_traits<_BidirectionalIterator>::reference _ReferenceType1; typedef typename std::iterator_traits<_OutputIterator>::reference _ReferenceType2; - return unseq_backend::simd_walk_2(std::reverse_iterator<_BidirectionalIterator>(__last), __last - __first, - __d_first, [](_ReferenceType1 __x, _ReferenceType2 __y) { __y = __x; }); + return __unseq_backend::__simd_walk_2(std::reverse_iterator<_BidirectionalIterator>(__last), __last - __first, + __d_first, [](_ReferenceType1 __x, _ReferenceType2 __y) { __y = __x; }); } template @@ -1503,15 +1503,16 @@ { for (; __last - __first >= __m_2; __first += __m) { - unseq_backend::simd_assign(__first, __m, __first + __m, iter_swap<_ForwardIterator, _ForwardIterator>); + __unseq_backend::__simd_assign(__first, __m, __first + __m, + iter_swap<_ForwardIterator, _ForwardIterator>); } } else { for (; __last - __first >= __m_2; __last -= __m) { - unseq_backend::simd_assign(__last - __m, __m, __last - __m_2, - iter_swap<_ForwardIterator, _ForwardIterator>); + __unseq_backend::__simd_assign(__last - __m, __m, __last - __m_2, + iter_swap<_ForwardIterator, _ForwardIterator>); } } __is_left = !__is_left; @@ -1676,9 +1677,9 @@ } else { - _ForwardIterator __result = - unseq_backend::simd_first(__first, _SizeType(0), __last - __first, - [&__pred](_ForwardIterator __it, _SizeType __i) { return !__pred(__it[__i]); }); + _ForwardIterator __result = __unseq_backend::__simd_first( + __first, _SizeType(0), __last - __first, + [&__pred](_ForwardIterator __it, _SizeType __i) { return !__pred(__it[__i]); }); if (__result == __last) { return true; @@ -1686,7 +1687,7 @@ else { ++__result; - return !unseq_backend::simd_or(__result, __last - __result, __pred); + return !__unseq_backend::__simd_or(__result, __last - __result, __pred); } } } @@ -1999,7 +2000,7 @@ _OutputIterator2 __out_false, _UnaryPredicate __pred, /*is_vector=*/std::true_type) noexcept { #if (__PSTL_MONOTONIC_PRESENT) - return unseq_backend::simd_partition_copy(__first, __last - __first, __out_true, __out_false, __pred); + return __unseq_backend::__simd_partition_copy(__first, __last - __first, __out_true, __out_false, __pred); #else return std::partition_copy(__first, __last, __out_true, __out_false, __pred); #endif @@ -2234,7 +2235,7 @@ __brick_adjacent_find(_ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pred, /* IsVector = */ std::true_type, bool __or_semantic) noexcept { - return unseq_backend::simd_adjacent_find(__first, __last, __pred, __or_semantic); + return __unseq_backend::__simd_adjacent_find(__first, __last, __pred, __or_semantic); } template @@ -2370,7 +2371,7 @@ __brick_fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, /* __is_vector = */ std::true_type) noexcept { - unseq_backend::simd_fill_n(__first, __last - __first, __value); + __unseq_backend::__simd_fill_n(__first, __last - __first, __value); } template @@ -2409,7 +2410,7 @@ _OutputIterator __brick_fill_n(_OutputIterator __first, _Size __count, const _Tp& __value, /* __is_vector = */ std::true_type) noexcept { - return unseq_backend::simd_fill_n(__first, __count, __value); + return __unseq_backend::__simd_fill_n(__first, __count, __value); } template @@ -2444,7 +2445,7 @@ __brick_generate(_RandomAccessIterator __first, _RandomAccessIterator __last, _Generator __g, /* is_vector = */ std::true_type) noexcept { - unseq_backend::simd_generate_n(__first, __last - __first, __g); + __unseq_backend::__simd_generate_n(__first, __last - __first, __g); } template @@ -2483,7 +2484,7 @@ OutputIterator __brick_generate_n(OutputIterator __first, Size __count, _Generator __g, /* is_vector = */ std::true_type) noexcept { - return unseq_backend::simd_generate_n(__first, __count, __g); + return __unseq_backend::__simd_generate_n(__first, __count, __g); } template @@ -2532,7 +2533,7 @@ /* __is_vector = */ std::true_type) noexcept { #if __PSTL_MONOTONIC_PRESENT - return unseq_backend::simd_remove_if(__first, __last - __first, __pred); + return __unseq_backend::__simd_remove_if(__first, __last - __first, __pred); #else return std::remove_if(__first, __last, __pred); #endif @@ -3307,7 +3308,7 @@ if (__last - __first < 2) return __last; typedef typename std::iterator_traits<_RandomAccessIterator>::difference_type _SizeType; - return unseq_backend::simd_first( + return __unseq_backend::__simd_first( __first, _SizeType(0), __last - __first, [&__comp](_RandomAccessIterator __it, _SizeType __i) { return __comp(__it[(__i - 1) / 2], __it[__i]); }); } @@ -3341,7 +3342,7 @@ is_heap_until_local(_RandomAccessIterator __first, _DifferenceType __begin, _DifferenceType __end, _Compare __comp, /* __is_vector = */ std::true_type) noexcept { - return unseq_backend::simd_first( + return __unseq_backend::__simd_first( __first, __begin, __end, [&__comp](_RandomAccessIterator __it, _DifferenceType __i) { return __comp(__it[(__i - 1) / 2], __it[__i]); }); } @@ -3384,7 +3385,7 @@ /* __is_vector = */ std::true_type) noexcept { #if __PSTL_UDR_PRESENT - return unseq_backend::simd_min_element(__first, __last - __first, __comp); + return __unseq_backend::__simd_min_element(__first, __last - __first, __comp); #else return std::min_element(__first, __last, __comp); #endif @@ -3440,7 +3441,7 @@ /* __is_vector = */ std::true_type) noexcept { #if __PSTL_UDR_PRESENT - return unseq_backend::simd_minmax_element(__first, __last - __first, __comp); + return __unseq_backend::__simd_minmax_element(__first, __last - __first, __comp); #else return std::minmax_element(__first, __last, __comp); #endif @@ -3515,7 +3516,7 @@ _ForwardIterator2 __last2, _Predicate __pred, /* __is_vector = */ std::true_type) noexcept { auto __n = std::min(__last1 - __first1, __last2 - __first2); - return unseq_backend::simd_first(__first1, __n, __first2, __not_pred<_Predicate>(__pred)); + return __unseq_backend::__simd_first(__first1, __n, __first2, __not_pred<_Predicate>(__pred)); } template @@ -3583,7 +3584,7 @@ --__last1; --__last2; auto __n = std::min(__last1 - __first1, __last2 - __first2); - std::pair<_ForwardIterator1, _ForwardIterator2> __result = unseq_backend::simd_first( + std::pair<_ForwardIterator1, _ForwardIterator2> __result = __unseq_backend::__simd_first( __first1, __n, __first2, [__comp](const ref_type1 __x, const ref_type2 __y) mutable { return __comp(__x, __y) || __comp(__y, __x); }); Index: include/pstl/internal/memory_impl.h =================================================================== --- include/pstl/internal/memory_impl.h +++ include/pstl/internal/memory_impl.h @@ -45,7 +45,7 @@ typedef typename std::iterator_traits<_ForwardIterator>::reference _ReferenceType1; typedef typename std::iterator_traits<_OutputIterator>::reference _ReferenceType2; - return unseq_backend::simd_walk_2( + return __unseq_backend::__simd_walk_2( __first, __last - __first, __result, [](_ReferenceType1 __x, _ReferenceType2 __y) { ::new (std::addressof(__y)) __ValueType2(std::move(__x)); }); } Index: include/pstl/internal/numeric_impl.h =================================================================== --- include/pstl/internal/numeric_impl.h +++ include/pstl/internal/numeric_impl.h @@ -47,7 +47,7 @@ /*is_vector=*/std::true_type) noexcept { typedef typename std::iterator_traits<_ForwardIterator1>::difference_type _DifferenceType; - return unseq_backend::simd_transform_reduce( + return __unseq_backend::__simd_transform_reduce( __last1 - __first1, __init, __binary_op1, [=, &__binary_op2](_DifferenceType __i) { return __binary_op2(__first1[__i], __first2[__i]); }); } @@ -110,7 +110,7 @@ _UnaryOperation __unary_op, /*is_vector=*/std::true_type) noexcept { typedef typename std::iterator_traits<_ForwardIterator>::difference_type _DifferenceType; - return unseq_backend::simd_transform_reduce( + return __unseq_backend::__simd_transform_reduce( __last - __first, __init, __binary_op, [=, &__unary_op](_DifferenceType __i) { return __unary_op(__first[__i]); }); } @@ -197,7 +197,8 @@ /*is_vector=*/std::true_type) noexcept { #if (__PSTL_UDS_PRESENT) - return unseq_backend::simd_scan(__first, __last - __first, __result, __unary_op, __init, __binary_op, _Inclusive()); + return __unseq_backend::__simd_scan(__first, __last - __first, __result, __unary_op, __init, __binary_op, + _Inclusive()); #else // We need to call serial brick here to call function for inclusive and exclusive scan that depends on _Inclusive() value return __brick_transform_scan(__first, __last, __result, __unary_op, __init, __binary_op, _Inclusive(), @@ -320,7 +321,7 @@ auto __n = __last - __first; *__d_first = *__first; - return unseq_backend::simd_walk_3( + return __unseq_backend::__simd_walk_3( __first + 1, __n - 1, __first, __d_first + 1, [&__op](_ReferenceType1 __x, _ReferenceType1 __y, _ReferenceType2 __z) { __z = __op(__x, __y); }); } Index: include/pstl/internal/unseq_backend_simd.h =================================================================== --- include/pstl/internal/unseq_backend_simd.h +++ include/pstl/internal/unseq_backend_simd.h @@ -18,7 +18,7 @@ // to support parallel STL. namespace __pstl { -namespace unseq_backend +namespace __unseq_backend { // Expect vector width up to 64 (or 512 bit) @@ -26,7 +26,7 @@ template _Iterator -simd_walk_1(_Iterator __first, _DifferenceType __n, _Function __f) noexcept +__simd_walk_1(_Iterator __first, _DifferenceType __n, _Function __f) noexcept { __PSTL_PRAGMA_SIMD for (_DifferenceType __i = 0; __i < __n; ++__i) @@ -37,7 +37,7 @@ template _Iterator2 -simd_walk_2(_Iterator1 __first1, _DifferenceType __n, _Iterator2 __first2, _Function __f) noexcept +__simd_walk_2(_Iterator1 __first1, _DifferenceType __n, _Iterator2 __first2, _Function __f) noexcept { __PSTL_PRAGMA_SIMD for (_DifferenceType __i = 0; __i < __n; ++__i) @@ -47,7 +47,8 @@ template _Iterator3 -simd_walk_3(_Iterator1 __first1, _DifferenceType __n, _Iterator2 __first2, _Iterator3 __first3, _Function __f) noexcept +__simd_walk_3(_Iterator1 __first1, _DifferenceType __n, _Iterator2 __first2, _Iterator3 __first3, + _Function __f) noexcept { __PSTL_PRAGMA_SIMD for (_DifferenceType __i = 0; __i < __n; ++__i) @@ -55,10 +56,10 @@ return __first3 + __n; } -// TODO: check whether simd_first() can be used here +// TODO: check whether __simd_first() can be used here template bool -simd_or(_Index __first, _DifferenceType __n, _Pred __pred) noexcept +__simd_or(_Index __first, _DifferenceType __n, _Pred __pred) noexcept { #if __PSTL_EARLYEXIT_PRESENT _DifferenceType __i; @@ -98,7 +99,7 @@ template _Index -simd_first(_Index __first, _DifferenceType __begin, _DifferenceType __end, _Compare __comp) noexcept +__simd_first(_Index __first, _DifferenceType __begin, _DifferenceType __end, _Compare __comp) noexcept { #if __PSTL_EARLYEXIT_PRESENT _DifferenceType __i = __begin; @@ -158,7 +159,7 @@ template std::pair<_Index1, _Index2> -simd_first(_Index1 __first1, _DifferenceType __n, _Index2 __first2, _Pred __pred) noexcept +__simd_first(_Index1 __first1, _DifferenceType __n, _Index2 __first2, _Pred __pred) noexcept { #if __PSTL_EARLYEXIT_PRESENT _DifferenceType __i = 0; @@ -212,7 +213,7 @@ template _DifferenceType -simd_count(_Index __index, _DifferenceType __n, _Pred __pred) noexcept +__simd_count(_Index __index, _DifferenceType __n, _Pred __pred) noexcept { _DifferenceType __count = 0; __PSTL_PRAGMA_SIMD_REDUCTION(+ : __count) @@ -225,8 +226,8 @@ template _OutputIterator -simd_unique_copy(_InputIterator __first, _DifferenceType __n, _OutputIterator __result, - _BinaryPredicate __pred) noexcept +__simd_unique_copy(_InputIterator __first, _DifferenceType __n, _OutputIterator __result, + _BinaryPredicate __pred) noexcept { if (__n == 0) return __result; @@ -249,7 +250,7 @@ template _OutputIterator -simd_assign(_InputIterator __first, _DifferenceType __n, _OutputIterator __result, _Assigner __assigner) noexcept +__simd_assign(_InputIterator __first, _DifferenceType __n, _OutputIterator __result, _Assigner __assigner) noexcept { __PSTL_USE_NONTEMPORAL_STORES_IF_ALLOWED __PSTL_PRAGMA_SIMD @@ -260,7 +261,7 @@ template _OutputIterator -simd_copy_if(_InputIterator __first, _DifferenceType __n, _OutputIterator __result, _UnaryPredicate __pred) noexcept +__simd_copy_if(_InputIterator __first, _DifferenceType __n, _OutputIterator __result, _UnaryPredicate __pred) noexcept { _DifferenceType __cnt = 0; @@ -279,7 +280,7 @@ template _DifferenceType -simd_calc_mask_2(_InputIterator __first, _DifferenceType __n, bool* __mask, _BinaryPredicate __pred) noexcept +__simd_calc_mask_2(_InputIterator __first, _DifferenceType __n, bool* __mask, _BinaryPredicate __pred) noexcept { _DifferenceType __count = 0; @@ -294,7 +295,7 @@ template _DifferenceType -simd_calc_mask_1(_InputIterator __first, _DifferenceType __n, bool* __mask, _UnaryPredicate __pred) noexcept +__simd_calc_mask_1(_InputIterator __first, _DifferenceType __n, bool* __mask, _UnaryPredicate __pred) noexcept { _DifferenceType __count = 0; @@ -309,8 +310,8 @@ template void -simd_copy_by_mask(_InputIterator __first, _DifferenceType __n, _OutputIterator __result, bool* __mask, - _Assigner __assigner) noexcept +__simd_copy_by_mask(_InputIterator __first, _DifferenceType __n, _OutputIterator __result, bool* __mask, + _Assigner __assigner) noexcept { _DifferenceType __cnt = 0; __PSTL_PRAGMA_SIMD @@ -329,8 +330,8 @@ template void -simd_partition_by_mask(_InputIterator __first, _DifferenceType __n, _OutputIterator1 __out_true, - _OutputIterator2 __out_false, bool* __mask) noexcept +__simd_partition_by_mask(_InputIterator __first, _DifferenceType __n, _OutputIterator1 __out_true, + _OutputIterator2 __out_false, bool* __mask) noexcept { _DifferenceType __cnt_true = 0, __cnt_false = 0; __PSTL_PRAGMA_SIMD @@ -352,7 +353,7 @@ template _Index -simd_fill_n(_Index __first, _DifferenceType __n, const _Tp& __value) noexcept +__simd_fill_n(_Index __first, _DifferenceType __n, const _Tp& __value) noexcept { __PSTL_USE_NONTEMPORAL_STORES_IF_ALLOWED __PSTL_PRAGMA_SIMD @@ -363,7 +364,7 @@ template _Index -simd_generate_n(_Index __first, _DifferenceType __size, _Generator __g) noexcept +__simd_generate_n(_Index __first, _DifferenceType __size, _Generator __g) noexcept { __PSTL_USE_NONTEMPORAL_STORES_IF_ALLOWED __PSTL_PRAGMA_SIMD @@ -374,7 +375,7 @@ template _Index -simd_adjacent_find(_Index __first, _Index __last, _BinaryPredicate __pred, bool __or_semantic) noexcept +__simd_adjacent_find(_Index __first, _Index __last, _BinaryPredicate __pred, bool __or_semantic) noexcept { if (__last - __first < 2) return __last; @@ -443,7 +444,7 @@ template typename std::enable_if::value, _Tp>::type -simd_transform_reduce(_DifferenceType __n, _Tp __init, _BinaryOperation, _UnaryOperation __f) noexcept +__simd_transform_reduce(_DifferenceType __n, _Tp __init, _BinaryOperation, _UnaryOperation __f) noexcept { __PSTL_PRAGMA_SIMD_REDUCTION(+ : __init) for (_DifferenceType __i = 0; __i < __n; ++__i) @@ -453,7 +454,7 @@ template typename std::enable_if::value, _Tp>::type -simd_transform_reduce(_Size __n, _Tp __init, _BinaryOperation __binary_op, _UnaryOperation __f) noexcept +__simd_transform_reduce(_Size __n, _Tp __init, _BinaryOperation __binary_op, _UnaryOperation __f) noexcept { const std::size_t __block_size = __lane_size / sizeof(_Tp); if (__n > 2 * __block_size && __block_size > 1) @@ -510,8 +511,8 @@ template typename std::enable_if::value, std::pair<_OutputIterator, _Tp>>::type -simd_scan(_InputIterator __first, _Size __n, _OutputIterator __result, _UnaryOperation __unary_op, _Tp __init, - _BinaryOperation, /*Inclusive*/ std::false_type) +__simd_scan(_InputIterator __first, _Size __n, _OutputIterator __result, _UnaryOperation __unary_op, _Tp __init, + _BinaryOperation, /*Inclusive*/ std::false_type) { __PSTL_PRAGMA_SIMD_SCAN(+ : __init) for (_Size __i = 0; __i < __n; ++__i) @@ -545,8 +546,8 @@ template typename std::enable_if::value, std::pair<_OutputIterator, _Tp>>::type -simd_scan(_InputIterator __first, _Size __n, _OutputIterator __result, _UnaryOperation __unary_op, _Tp __init, - _BinaryOperation __binary_op, /*Inclusive*/ std::false_type) +__simd_scan(_InputIterator __first, _Size __n, _OutputIterator __result, _UnaryOperation __unary_op, _Tp __init, + _BinaryOperation __binary_op, /*Inclusive*/ std::false_type) { typedef _Combiner<_Tp, _BinaryOperation> _CombinerType; _CombinerType __init_{__init, &__binary_op}; @@ -568,8 +569,8 @@ template typename std::enable_if::value, std::pair<_OutputIterator, _Tp>>::type -simd_scan(_InputIterator __first, _Size __n, _OutputIterator __result, _UnaryOperation __unary_op, _Tp __init, - _BinaryOperation, /*Inclusive*/ std::true_type) +__simd_scan(_InputIterator __first, _Size __n, _OutputIterator __result, _UnaryOperation __unary_op, _Tp __init, + _BinaryOperation, /*Inclusive*/ std::true_type) { __PSTL_PRAGMA_SIMD_SCAN(+ : __init) for (_Size __i = 0; __i < __n; ++__i) @@ -585,8 +586,8 @@ template typename std::enable_if::value, std::pair<_OutputIterator, _Tp>>::type -simd_scan(_InputIterator __first, _Size __n, _OutputIterator __result, _UnaryOperation __unary_op, _Tp __init, - _BinaryOperation __binary_op, std::true_type) +__simd_scan(_InputIterator __first, _Size __n, _OutputIterator __result, _UnaryOperation __unary_op, _Tp __init, + _BinaryOperation __binary_op, std::true_type) { typedef _Combiner<_Tp, _BinaryOperation> _CombinerType; _CombinerType __init_{__init, &__binary_op}; @@ -608,7 +609,7 @@ // complexity [violation] - We will have at most (__n-1 + number_of_lanes) comparisons instead of at most __n-1. template _ForwardIterator -simd_min_element(_ForwardIterator __first, _Size __n, _Compare __comp) noexcept +__simd_min_element(_ForwardIterator __first, _Size __n, _Compare __comp) noexcept { if (__n == 0) { @@ -667,7 +668,7 @@ // complexity [violation] - We will have at most (2*(__n-1) + 4*number_of_lanes) comparisons instead of at most [1.5*(__n-1)]. template std::pair<_ForwardIterator, _ForwardIterator> -simd_minmax_element(_ForwardIterator __first, _Size __n, _Compare __comp) noexcept +__simd_minmax_element(_ForwardIterator __first, _Size __n, _Compare __comp) noexcept { if (__n == 0) { @@ -751,8 +752,8 @@ template std::pair<_OutputIterator1, _OutputIterator2> -simd_partition_copy(_InputIterator __first, _DifferenceType __n, _OutputIterator1 __out_true, - _OutputIterator2 __out_false, _UnaryPredicate __pred) noexcept +__simd_partition_copy(_InputIterator __first, _DifferenceType __n, _OutputIterator1 __out_true, + _OutputIterator2 __out_false, _UnaryPredicate __pred) noexcept { _DifferenceType __cnt_true = 0, __cnt_false = 0; @@ -776,8 +777,8 @@ template _ForwardIterator1 -simd_find_first_of(_ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __s_first, - _ForwardIterator2 __s_last, _BinaryPredicate __pred) noexcept +__simd_find_first_of(_ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __s_first, + _ForwardIterator2 __s_last, _BinaryPredicate __pred) noexcept { typedef typename std::iterator_traits<_ForwardIterator1>::difference_type _DifferencType; @@ -795,8 +796,8 @@ { for (; __first != __last; ++__first) { - if (simd_or(__s_first, __n2, - __internal::__equal_value_by_pred(*__first, __pred))) + if (__simd_or(__s_first, __n2, + __internal::__equal_value_by_pred(*__first, __pred))) { return __first; } @@ -806,10 +807,10 @@ { for (; __s_first != __s_last; ++__s_first) { - const auto __result = unseq_backend::simd_first( - __first, _DifferencType(0), __n1, [__s_first, &__pred](_ForwardIterator1 __it, _DifferencType __i) { - return __pred(__it[__i], *__s_first); - }); + const auto __result = __simd_first(__first, _DifferencType(0), __n1, + [__s_first, &__pred](_ForwardIterator1 __it, _DifferencType __i) { + return __pred(__it[__i], *__s_first); + }); if (__result != __last) { return __result; @@ -821,12 +822,12 @@ template _RandomAccessIterator -simd_remove_if(_RandomAccessIterator __first, _DifferenceType __n, _UnaryPredicate __pred) noexcept +__simd_remove_if(_RandomAccessIterator __first, _DifferenceType __n, _UnaryPredicate __pred) noexcept { // find first element we need to remove - auto __current = unseq_backend::simd_first( - __first, _DifferenceType(0), __n, - [&__pred](_RandomAccessIterator __it, _DifferenceType __i) { return __pred(__it[__i]); }); + auto __current = + __simd_first(__first, _DifferenceType(0), __n, + [&__pred](_RandomAccessIterator __it, _DifferenceType __i) { return __pred(__it[__i]); }); __n -= __current - __first; // if we have in sequence only one element that pred(__current[1]) != false we can exit the function @@ -848,7 +849,7 @@ } return __current + __cnt; } -} // namespace unseq_backend +} // namespace __unseq_backend } // namespace __pstl #endif /* __PSTL_unseq_backend_simd_H */