25#ifndef _GLIBCXX_SIMD_REDUCTIONS_H
26#define _GLIBCXX_SIMD_REDUCTIONS_H 1
29#pragma GCC system_header
32#if __cplusplus >= 202400L
37#pragma GCC diagnostic push
38#pragma GCC diagnostic ignored "-Wpsabi"
41namespace std _GLIBCXX_VISIBILITY(default)
43_GLIBCXX_BEGIN_NAMESPACE_VERSION
46 template <
typename _Tp,
typename _Ap, __reduction_binary_operation<_Tp> _BinaryOperation = plus<>>
47 [[__gnu__::__always_inline__]]
49 reduce(
const basic_vec<_Tp, _Ap>& __x, _BinaryOperation __binary_op = {})
50 {
return __x._M_reduce(__binary_op); }
52 template <
typename _Tp,
typename _Ap, __reduction_binary_operation<_Tp> _BinaryOperation = plus<>>
53 [[__gnu__::__always_inline__]]
55 reduce(
const basic_vec<_Tp, _Ap>& __x,
const typename basic_vec<_Tp, _Ap>::mask_type& __mask,
56 _BinaryOperation __binary_op = {}, type_identity_t<_Tp> __identity_element
57 = __default_identity_element<_Tp, _BinaryOperation>())
58 {
return reduce(__select_impl(__mask, __x, __identity_element), __binary_op); }
60 template <totally_ordered _Tp,
typename _Ap>
61 [[__gnu__::__always_inline__]]
63 reduce_min(
const basic_vec<_Tp, _Ap>& __x)
noexcept
65 return reduce(__x, []<
typename _UV>(
const _UV& __a,
const _UV& __b) {
66 return __select_impl(__a < __b, __a, __b);
70 template <totally_ordered _Tp,
typename _Ap>
71 [[__gnu__::__always_inline__]]
73 reduce_min(
const basic_vec<_Tp, _Ap>& __x,
74 const typename basic_vec<_Tp, _Ap>::mask_type& __mask)
noexcept
77 []<
typename _UV>(
const _UV& __a,
const _UV& __b) {
78 return __select_impl(__a < __b, __a, __b);
82 template <totally_ordered _Tp,
typename _Ap>
83 [[__gnu__::__always_inline__]]
85 reduce_max(
const basic_vec<_Tp, _Ap>& __x)
noexcept
87 return reduce(__x, []<
typename _UV>(
const _UV& __a,
const _UV& __b) {
88 return __select_impl(__a < __b, __b, __a);
92 template <totally_ordered _Tp,
typename _Ap>
93 [[__gnu__::__always_inline__]]
95 reduce_max(
const basic_vec<_Tp, _Ap>& __x,
96 const typename basic_vec<_Tp, _Ap>::mask_type& __mask)
noexcept
99 []<
typename _UV>(
const _UV& __a,
const _UV& __b) {
100 return __select_impl(__a < __b, __b, __a);
104_GLIBCXX_END_NAMESPACE_VERSION
107#pragma GCC diagnostic pop
ISO C++ entities toplevel namespace is std.
static constexpr _Tp max() noexcept
static constexpr _Tp lowest() noexcept