From: Matthias Kretz Date: Tue, 21 Feb 2023 07:48:18 +0000 (+0100) Subject: libstdc++: Fix formatting X-Git-Tag: upstream/13.1.0~909 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b31186e589caee43ac5720a538d9a41ebf514e81;p=platform%2Fupstream%2Fgcc.git libstdc++: Fix formatting Whitespace changes only. Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: * include/experimental/bits/simd.h: Line breaks and indenting fixed to follow the libstdc++ standard. * include/experimental/bits/simd_builtin.h: Likewise. * include/experimental/bits/simd_fixed_size.h: Likewise. * include/experimental/bits/simd_neon.h: Likewise. * include/experimental/bits/simd_ppc.h: Likewise. * include/experimental/bits/simd_scalar.h: Likewise. * include/experimental/bits/simd_x86.h: Likewise. --- diff --git a/libstdc++-v3/include/experimental/bits/simd.h b/libstdc++-v3/include/experimental/bits/simd.h index 7482d10..4df4466 100644 --- a/libstdc++-v3/include/experimental/bits/simd.h +++ b/libstdc++-v3/include/experimental/bits/simd.h @@ -180,10 +180,7 @@ struct vector_aligned_tag template _GLIBCXX_SIMD_INTRINSIC static constexpr _Up* _S_apply(_Up* __ptr) - { - return static_cast<_Up*>( - __builtin_assume_aligned(__ptr, _S_alignment<_Tp, _Up>)); - } + { return static_cast<_Up*>(__builtin_assume_aligned(__ptr, _S_alignment<_Tp, _Up>)); } }; template struct overaligned_tag @@ -288,13 +285,15 @@ namespace __detail // expression. math_errhandling may expand to an extern symbol, in which case a constexpr value // must be guessed. template - constexpr bool __handle_fpexcept_impl(int) + constexpr bool + __handle_fpexcept_impl(int) { return math_errhandling & MATH_ERREXCEPT; } #endif // Fallback if math_errhandling doesn't work: with fast-math assume floating-point exceptions are // ignored, otherwise implement correct exception behavior. - constexpr bool __handle_fpexcept_impl(float) + constexpr bool + __handle_fpexcept_impl(float) { #if defined __FAST_MATH__ return false; @@ -749,8 +748,7 @@ template // __invoke_ub{{{ template [[noreturn]] _GLIBCXX_SIMD_ALWAYS_INLINE void - __invoke_ub([[maybe_unused]] const char* __msg, - [[maybe_unused]] const _Args&... __args) + __invoke_ub([[maybe_unused]] const char* __msg, [[maybe_unused]] const _Args&... __args) { #ifdef _GLIBCXX_DEBUG_UB __builtin_fprintf(stderr, __msg, __args...); @@ -795,11 +793,14 @@ class _ExactBool const bool _M_data; public: - _GLIBCXX_SIMD_INTRINSIC constexpr _ExactBool(bool __b) : _M_data(__b) {} + _GLIBCXX_SIMD_INTRINSIC constexpr + _ExactBool(bool __b) : _M_data(__b) {} _ExactBool(int) = delete; - _GLIBCXX_SIMD_INTRINSIC constexpr operator bool() const { return _M_data; } + _GLIBCXX_SIMD_INTRINSIC constexpr + operator bool() const + { return _M_data; } }; // }}} @@ -1488,8 +1489,7 @@ template // else, use GNU-style builtin vector types template - struct __vector_type_n<_Tp, _Np, - enable_if_t<__is_vectorizable_v<_Tp> && _Np >= 2>> + struct __vector_type_n<_Tp, _Np, enable_if_t<__is_vectorizable_v<_Tp> && _Np >= 2>> { static constexpr size_t _S_Np2 = std::__bit_ceil(_Np * sizeof(_Tp)); @@ -1770,8 +1770,7 @@ template // }}} // __to_intrin {{{ template , - typename _R - = __intrinsic_type_t> + typename _R = __intrinsic_type_t> _GLIBCXX_SIMD_INTRINSIC constexpr _R __to_intrin(_Tp __x) { @@ -1792,9 +1791,7 @@ template , template _GLIBCXX_SIMD_INTRINSIC constexpr __vector_type_t<_Tp, sizeof...(_Args)> __make_vector(const _Args&... __args) - { - return __vector_type_t<_Tp, sizeof...(_Args)>{static_cast<_Tp>(__args)...}; - } + { return __vector_type_t<_Tp, sizeof...(_Args)>{static_cast<_Tp>(__args)...}; } // }}} // __vector_broadcast{{{ @@ -1813,10 +1810,7 @@ template template _GLIBCXX_SIMD_INTRINSIC constexpr __vector_type_t<_Tp, _Np> __generate_vector_impl(_Gp&& __gen, index_sequence<_I...>) - { - return __vector_type_t<_Tp, _Np>{ - static_cast<_Tp>(__gen(_SizeConstant<_I>()))...}; - } + { return __vector_type_t<_Tp, _Np>{ static_cast<_Tp>(__gen(_SizeConstant<_I>()))...}; } template , typename _Gp> _GLIBCXX_SIMD_INTRINSIC constexpr _V @@ -2029,8 +2023,7 @@ template > // }}} // __concat{{{ template , - typename _R = __vector_type_t> + typename _R = __vector_type_t> constexpr _R __concat(_Tp a_, _Tp b_) { @@ -2174,8 +2167,7 @@ template , - typename _R = __vector_type_t> + typename _R = __vector_type_t> _GLIBCXX_SIMD_INTRINSIC constexpr _R __extract(_Tp __in) { @@ -2221,8 +2213,7 @@ template ::value_type>> + typename _R = __vector_type8_t::value_type>> _GLIBCXX_SIMD_INTRINSIC constexpr _R __lo64(_Tp __x) { @@ -2232,8 +2223,7 @@ template ::value_type>> + typename _R = __vector_type8_t::value_type>> _GLIBCXX_SIMD_INTRINSIC constexpr _R __hi64(_Tp __x) { @@ -2244,8 +2234,7 @@ template ::value_type>> + typename _R = __vector_type8_t::value_type>> _GLIBCXX_SIMD_INTRINSIC constexpr _R __hi64z([[maybe_unused]] _Tp __x) { @@ -2356,18 +2345,15 @@ template <> // the following excludes bool via __is_vectorizable #if _GLIBCXX_SIMD_HAVE_SSE template - struct __intrinsic_type<_Tp, _Bytes, - enable_if_t<__is_vectorizable_v<_Tp> && _Bytes <= 64>> + struct __intrinsic_type<_Tp, _Bytes, enable_if_t<__is_vectorizable_v<_Tp> && _Bytes <= 64>> { static_assert(!is_same_v<_Tp, long double>, "no __intrinsic_type support for long double on x86"); - static constexpr size_t _S_VBytes = _Bytes <= 16 ? 16 - : _Bytes <= 32 ? 32 - : 64; + static constexpr size_t _S_VBytes = _Bytes <= 16 ? 16 : _Bytes <= 32 ? 32 : 64; using type [[__gnu__::__vector_size__(_S_VBytes)]] - = conditional_t, long long int, _Tp>; + = conditional_t, long long int, _Tp>; }; #endif // _GLIBCXX_SIMD_HAVE_SSE @@ -2413,16 +2399,19 @@ _GLIBCXX_SIMD_ARM_INTRIN(64, 2); #undef _GLIBCXX_SIMD_ARM_INTRIN template - struct __intrinsic_type<_Tp, _Bytes, - enable_if_t<__is_vectorizable_v<_Tp> && _Bytes <= 16>> + struct __intrinsic_type<_Tp, _Bytes, enable_if_t<__is_vectorizable_v<_Tp> && _Bytes <= 16>> { static constexpr int _SVecBytes = _Bytes <= 8 ? 8 : 16; + using _Ip = __int_for_sizeof_t<_Tp>; + using _Up = conditional_t< is_floating_point_v<_Tp>, _Tp, conditional_t, make_unsigned_t<_Ip>, _Ip>>; + static_assert(!is_same_v<_Tp, _Up> || _SVecBytes != _Bytes, "should use explicit specialization above"); + using type = typename __intrinsic_type<_Up, _SVecBytes>::type; }; #endif // _GLIBCXX_SIMD_HAVE_NEON @@ -2457,18 +2446,20 @@ _GLIBCXX_SIMD_PPC_INTRIN(unsigned long long); #undef _GLIBCXX_SIMD_PPC_INTRIN template - struct __intrinsic_type<_Tp, _Bytes, - enable_if_t<__is_vectorizable_v<_Tp> && _Bytes <= 16>> + struct __intrinsic_type<_Tp, _Bytes, enable_if_t<__is_vectorizable_v<_Tp> && _Bytes <= 16>> { static constexpr bool _S_is_ldouble = is_same_v<_Tp, long double>; + // allow _Tp == long double with -mlong-double-64 static_assert(!(_S_is_ldouble && sizeof(long double) > sizeof(double)), "no __intrinsic_type support for 128-bit floating point on PowerPC"); + #ifndef __VSX__ static_assert(!(is_same_v<_Tp, double> || (_S_is_ldouble && sizeof(long double) == sizeof(double))), "no __intrinsic_type support for 64-bit floating point on PowerPC w/o VSX"); #endif + using type = typename __intrinsic_type_impl< conditional_t, @@ -2489,22 +2480,29 @@ template static constexpr size_t _S_full_size = sizeof(_BuiltinType) * __CHAR_BIT__; _GLIBCXX_SIMD_INTRINSIC constexpr _SimdWrapper - __as_full_vector() const { return _M_data; } + __as_full_vector() const + { return _M_data; } + + _GLIBCXX_SIMD_INTRINSIC constexpr + _SimdWrapper() = default; - _GLIBCXX_SIMD_INTRINSIC constexpr _SimdWrapper() = default; - _GLIBCXX_SIMD_INTRINSIC constexpr _SimdWrapper(_BuiltinType __k) - : _M_data(__k) {}; + _GLIBCXX_SIMD_INTRINSIC constexpr + _SimdWrapper(_BuiltinType __k) : _M_data(__k) {}; - _GLIBCXX_SIMD_INTRINSIC operator const _BuiltinType&() const + _GLIBCXX_SIMD_INTRINSIC + operator const _BuiltinType&() const { return _M_data; } - _GLIBCXX_SIMD_INTRINSIC operator _BuiltinType&() + _GLIBCXX_SIMD_INTRINSIC + operator _BuiltinType&() { return _M_data; } - _GLIBCXX_SIMD_INTRINSIC _BuiltinType __intrin() const + _GLIBCXX_SIMD_INTRINSIC _BuiltinType + __intrin() const { return _M_data; } - _GLIBCXX_SIMD_INTRINSIC constexpr value_type operator[](size_t __i) const + _GLIBCXX_SIMD_INTRINSIC constexpr value_type + operator[](size_t __i) const { return _M_data & (_BuiltinType(1) << __i); } template @@ -2512,7 +2510,8 @@ template operator[](_SizeConstant<__i>) const { return _M_data & (_BuiltinType(1) << __i); } - _GLIBCXX_SIMD_INTRINSIC constexpr void _M_set(size_t __i, value_type __x) + _GLIBCXX_SIMD_INTRINSIC constexpr void + _M_set(size_t __i, value_type __x) { if (__x) _M_data |= (_BuiltinType(1) << __i); @@ -2520,11 +2519,12 @@ template _M_data &= ~(_BuiltinType(1) << __i); } - _GLIBCXX_SIMD_INTRINSIC - constexpr bool _M_is_constprop() const + _GLIBCXX_SIMD_INTRINSIC constexpr bool + _M_is_constprop() const { return __builtin_constant_p(_M_data); } - _GLIBCXX_SIMD_INTRINSIC constexpr bool _M_is_constprop_none_of() const + _GLIBCXX_SIMD_INTRINSIC constexpr bool + _M_is_constprop_none_of() const { if (__builtin_constant_p(_M_data)) { @@ -2536,7 +2536,8 @@ template return false; } - _GLIBCXX_SIMD_INTRINSIC constexpr bool _M_is_constprop_all_of() const + _GLIBCXX_SIMD_INTRINSIC constexpr bool + _M_is_constprop_all_of() const { if (__builtin_constant_p(_M_data)) { @@ -2558,10 +2559,11 @@ template template struct _SimdWrapperBase // no padding or no SNaNs { - _GLIBCXX_SIMD_INTRINSIC constexpr _SimdWrapperBase() = default; - _GLIBCXX_SIMD_INTRINSIC constexpr _SimdWrapperBase(_BuiltinType __init) - : _M_data(__init) - {} + _GLIBCXX_SIMD_INTRINSIC constexpr + _SimdWrapperBase() = default; + + _GLIBCXX_SIMD_INTRINSIC constexpr + _SimdWrapperBase(_BuiltinType __init) : _M_data(__init) {} _BuiltinType _M_data; }; @@ -2570,10 +2572,11 @@ template struct _SimdWrapperBase // with padding that needs to // never become SNaN { - _GLIBCXX_SIMD_INTRINSIC constexpr _SimdWrapperBase() : _M_data() {} - _GLIBCXX_SIMD_INTRINSIC constexpr _SimdWrapperBase(_BuiltinType __init) - : _M_data(__init) - {} + _GLIBCXX_SIMD_INTRINSIC constexpr + _SimdWrapperBase() : _M_data() {} + + _GLIBCXX_SIMD_INTRINSIC constexpr + _SimdWrapperBase(_BuiltinType __init) : _M_data(__init) {} _BuiltinType _M_data; }; @@ -2612,24 +2615,33 @@ template __as_full_vector() const { return _M_data; } - _GLIBCXX_SIMD_INTRINSIC constexpr _SimdWrapper(initializer_list<_Tp> __init) - : _Base(__generate_from_n_evaluations<_Width, _BuiltinType>( - [&](auto __i) _GLIBCXX_SIMD_ALWAYS_INLINE_LAMBDA { return __init.begin()[__i.value]; })) {} + _GLIBCXX_SIMD_INTRINSIC constexpr + _SimdWrapper(initializer_list<_Tp> __init) + : _Base(__generate_from_n_evaluations<_Width, _BuiltinType>( + [&](auto __i) _GLIBCXX_SIMD_ALWAYS_INLINE_LAMBDA { + return __init.begin()[__i.value]; + })) {} - _GLIBCXX_SIMD_INTRINSIC constexpr _SimdWrapper() = default; - _GLIBCXX_SIMD_INTRINSIC constexpr _SimdWrapper(const _SimdWrapper&) - = default; - _GLIBCXX_SIMD_INTRINSIC constexpr _SimdWrapper(_SimdWrapper&&) = default; + _GLIBCXX_SIMD_INTRINSIC constexpr + _SimdWrapper() = default; + + _GLIBCXX_SIMD_INTRINSIC constexpr + _SimdWrapper(const _SimdWrapper&) = default; + + _GLIBCXX_SIMD_INTRINSIC constexpr + _SimdWrapper(_SimdWrapper&&) = default; _GLIBCXX_SIMD_INTRINSIC constexpr _SimdWrapper& operator=(const _SimdWrapper&) = default; + _GLIBCXX_SIMD_INTRINSIC constexpr _SimdWrapper& operator=(_SimdWrapper&&) = default; template >, is_same<_V, __intrinsic_type_t<_Tp, _Width>>>>> - _GLIBCXX_SIMD_INTRINSIC constexpr _SimdWrapper(_V __x) + _GLIBCXX_SIMD_INTRINSIC constexpr + _SimdWrapper(_V __x) // __vector_bitcast can convert e.g. __m128 to __vector(2) float : _Base(__vector_bitcast<_Tp, _Width>(__x)) {} @@ -2644,27 +2656,34 @@ template { return _M_data[int(__i)]; }); } - _GLIBCXX_SIMD_INTRINSIC constexpr operator const _BuiltinType&() const + _GLIBCXX_SIMD_INTRINSIC constexpr + operator const _BuiltinType&() const { return _M_data; } - _GLIBCXX_SIMD_INTRINSIC constexpr operator _BuiltinType&() + _GLIBCXX_SIMD_INTRINSIC constexpr + operator _BuiltinType&() { return _M_data; } - _GLIBCXX_SIMD_INTRINSIC constexpr _Tp operator[](size_t __i) const + _GLIBCXX_SIMD_INTRINSIC constexpr _Tp + operator[](size_t __i) const { return _M_data[__i]; } template - _GLIBCXX_SIMD_INTRINSIC constexpr _Tp operator[](_SizeConstant<__i>) const + _GLIBCXX_SIMD_INTRINSIC constexpr _Tp + operator[](_SizeConstant<__i>) const { return _M_data[__i]; } - _GLIBCXX_SIMD_INTRINSIC constexpr void _M_set(size_t __i, _Tp __x) + _GLIBCXX_SIMD_INTRINSIC constexpr void + _M_set(size_t __i, _Tp __x) { _M_data[__i] = __x; } _GLIBCXX_SIMD_INTRINSIC - constexpr bool _M_is_constprop() const + constexpr bool + _M_is_constprop() const { return __builtin_constant_p(_M_data); } - _GLIBCXX_SIMD_INTRINSIC constexpr bool _M_is_constprop_none_of() const + _GLIBCXX_SIMD_INTRINSIC constexpr bool + _M_is_constprop_none_of() const { if (__builtin_constant_p(_M_data)) { @@ -2685,7 +2704,8 @@ template return false; } - _GLIBCXX_SIMD_INTRINSIC constexpr bool _M_is_constprop_all_of() const + _GLIBCXX_SIMD_INTRINSIC constexpr bool + _M_is_constprop_all_of() const { if (__builtin_constant_p(_M_data)) { @@ -2883,22 +2903,14 @@ template struct rebind_simd; template - struct rebind_simd< - _Tp, simd<_Up, _Abi>, - void_t, _Abi>>> - { - using type - = simd<_Tp, simd_abi::deduce_t<_Tp, simd_size_v<_Up, _Abi>, _Abi>>; - }; + struct rebind_simd<_Tp, simd<_Up, _Abi>, + void_t, _Abi>>> + { using type = simd<_Tp, simd_abi::deduce_t<_Tp, simd_size_v<_Up, _Abi>, _Abi>>; }; template - struct rebind_simd< - _Tp, simd_mask<_Up, _Abi>, - void_t, _Abi>>> - { - using type - = simd_mask<_Tp, simd_abi::deduce_t<_Tp, simd_size_v<_Up, _Abi>, _Abi>>; - }; + struct rebind_simd<_Tp, simd_mask<_Up, _Abi>, + void_t, _Abi>>> + { using type = simd_mask<_Tp, simd_abi::deduce_t<_Tp, simd_size_v<_Up, _Abi>, _Abi>>; }; template using rebind_simd_t = typename rebind_simd<_Tp, _V>::type; @@ -2908,13 +2920,11 @@ template struct resize_simd; template - struct resize_simd<_Np, simd<_Tp, _Abi>, - void_t>> + struct resize_simd<_Np, simd<_Tp, _Abi>, void_t>> { using type = simd<_Tp, simd_abi::deduce_t<_Tp, _Np, _Abi>>; }; template - struct resize_simd<_Np, simd_mask<_Tp, _Abi>, - void_t>> + struct resize_simd<_Np, simd_mask<_Tp, _Abi>, void_t>> { using type = simd_mask<_Tp, simd_abi::deduce_t<_Tp, _Np, _Abi>>; }; template @@ -2963,13 +2973,11 @@ template // casts [simd.casts] {{{1 // static_simd_cast {{{2 -template , - typename = void> +template , typename = void> struct __static_simd_cast_return_type; template - struct __static_simd_cast_return_type, _Up, _Ap, false, - void> + struct __static_simd_cast_return_type, _Up, _Ap, false, void> : __static_simd_cast_return_type, _Up, _Ap> {}; template @@ -3284,6 +3292,7 @@ template public: const_where_expression(const const_where_expression&) = delete; + const_where_expression& operator=(const const_where_expression&) = delete; _GLIBCXX_SIMD_INTRINSIC const_where_expression(const _M& __kk, const _Tp& dd) @@ -3328,8 +3337,8 @@ template struct _Wrapper { using value_type = _V; }; protected: - using value_type = - typename conditional_t, _Wrapper, _V>::value_type; + using value_type + = typename conditional_t, _Wrapper, _V>::value_type; _GLIBCXX_SIMD_INTRINSIC friend const _M& __get_mask(const const_where_expression& __x) @@ -3426,32 +3435,32 @@ template _GLIBCXX_SIMD_OP_(>>, _S_shift_right); #undef _GLIBCXX_SIMD_OP_ - _GLIBCXX_SIMD_INTRINSIC void operator++() && + _GLIBCXX_SIMD_INTRINSIC void + operator++() && { __data(_M_value) - = _Impl::template _S_masked_unary<__increment>(__data(_M_k), - __data(_M_value)); + = _Impl::template _S_masked_unary<__increment>(__data(_M_k), __data(_M_value)); } - _GLIBCXX_SIMD_INTRINSIC void operator++(int) && + _GLIBCXX_SIMD_INTRINSIC void + operator++(int) && { __data(_M_value) - = _Impl::template _S_masked_unary<__increment>(__data(_M_k), - __data(_M_value)); + = _Impl::template _S_masked_unary<__increment>(__data(_M_k), __data(_M_value)); } - _GLIBCXX_SIMD_INTRINSIC void operator--() && + _GLIBCXX_SIMD_INTRINSIC void + operator--() && { __data(_M_value) - = _Impl::template _S_masked_unary<__decrement>(__data(_M_k), - __data(_M_value)); + = _Impl::template _S_masked_unary<__decrement>(__data(_M_k), __data(_M_value)); } - _GLIBCXX_SIMD_INTRINSIC void operator--(int) && + _GLIBCXX_SIMD_INTRINSIC void + operator--(int) && { __data(_M_value) - = _Impl::template _S_masked_unary<__decrement>(__data(_M_k), - __data(_M_value)); + = _Impl::template _S_masked_unary<__decrement>(__data(_M_k), __data(_M_value)); } // intentionally hides const_where_expression::copy_from @@ -3459,15 +3468,15 @@ template _GLIBCXX_SIMD_INTRINSIC void copy_from(const _LoadStorePtr<_Up, value_type>* __mem, _Flags) && { - __data(_M_value) - = _Impl::_S_masked_load(__data(_M_value), __data(_M_k), - _Flags::template _S_apply<_Tp>(__mem)); + __data(_M_value) = _Impl::_S_masked_load(__data(_M_value), __data(_M_k), + _Flags::template _S_apply<_Tp>(__mem)); } }; // where_expression {{{2 template - class where_expression : public const_where_expression + class where_expression + : public const_where_expression { using _M = bool; using typename const_where_expression<_M, _Tp>::value_type; @@ -3478,12 +3487,14 @@ template where_expression(const where_expression&) = delete; where_expression& operator=(const where_expression&) = delete; - _GLIBCXX_SIMD_INTRINSIC where_expression(const _M& __kk, _Tp& dd) - : const_where_expression<_M, _Tp>(__kk, dd) {} + _GLIBCXX_SIMD_INTRINSIC + where_expression(const _M& __kk, _Tp& dd) + : const_where_expression<_M, _Tp>(__kk, dd) {} #define _GLIBCXX_SIMD_OP_(__op) \ template \ - _GLIBCXX_SIMD_INTRINSIC void operator __op(_Up&& __x)&& \ + _GLIBCXX_SIMD_INTRINSIC void \ + operator __op(_Up&& __x)&& \ { if (_M_k) _M_value __op static_cast<_Up&&>(__x); } _GLIBCXX_SIMD_OP_(=) @@ -3499,16 +3510,20 @@ template _GLIBCXX_SIMD_OP_(>>=) #undef _GLIBCXX_SIMD_OP_ - _GLIBCXX_SIMD_INTRINSIC void operator++() && + _GLIBCXX_SIMD_INTRINSIC void + operator++() && { if (_M_k) ++_M_value; } - _GLIBCXX_SIMD_INTRINSIC void operator++(int) && + _GLIBCXX_SIMD_INTRINSIC void + operator++(int) && { if (_M_k) ++_M_value; } - _GLIBCXX_SIMD_INTRINSIC void operator--() && + _GLIBCXX_SIMD_INTRINSIC void + operator--() && { if (_M_k) --_M_value; } - _GLIBCXX_SIMD_INTRINSIC void operator--(int) && + _GLIBCXX_SIMD_INTRINSIC void + operator--(int) && { if (_M_k) --_M_value; } // intentionally hides const_where_expression::copy_from @@ -3526,23 +3541,20 @@ template template _GLIBCXX_SIMD_INTRINSIC - const_where_expression, simd<_Tp, _Ap>> - where(const typename simd<_Tp, _Ap>::mask_type& __k, - const simd<_Tp, _Ap>& __value) + const_where_expression, simd<_Tp, _Ap>> + where(const typename simd<_Tp, _Ap>::mask_type& __k, const simd<_Tp, _Ap>& __value) { return {__k, __value}; } template _GLIBCXX_SIMD_INTRINSIC - where_expression, simd_mask<_Tp, _Ap>> - where(const remove_const_t>& __k, - simd_mask<_Tp, _Ap>& __value) + where_expression, simd_mask<_Tp, _Ap>> + where(const remove_const_t>& __k, simd_mask<_Tp, _Ap>& __value) { return {__k, __value}; } template _GLIBCXX_SIMD_INTRINSIC - const_where_expression, simd_mask<_Tp, _Ap>> - where(const remove_const_t>& __k, - const simd_mask<_Tp, _Ap>& __value) + const_where_expression, simd_mask<_Tp, _Ap>> + where(const remove_const_t>& __k, const simd_mask<_Tp, _Ap>& __value) { return {__k, __value}; } template @@ -3555,11 +3567,11 @@ template where(_ExactBool __k, const _Tp& __value) { return {__k, __value}; } - template - void where(bool __k, simd<_Tp, _Ap>& __value) = delete; +template + void where(bool __k, simd<_Tp, _Ap>& __value) = delete; - template - void where(bool __k, const simd<_Tp, _Ap>& __value) = delete; +template + void where(bool __k, const simd<_Tp, _Ap>& __value) = delete; // proposed mask iterations {{{1 namespace __proposed { @@ -3576,10 +3588,12 @@ template size_t __mask; size_t __bit; - _GLIBCXX_SIMD_INTRINSIC void __next_bit() + _GLIBCXX_SIMD_INTRINSIC void + __next_bit() { __bit = __builtin_ctzl(__mask); } - _GLIBCXX_SIMD_INTRINSIC void __reset_lsb() + _GLIBCXX_SIMD_INTRINSIC void + __reset_lsb() { // 01100100 - 1 = 01100011 __mask &= (__mask - 1); @@ -3591,20 +3605,24 @@ template iterator(const iterator&) = default; iterator(iterator&&) = default; - _GLIBCXX_SIMD_ALWAYS_INLINE size_t operator->() const + _GLIBCXX_SIMD_ALWAYS_INLINE size_t + operator->() const { return __bit; } - _GLIBCXX_SIMD_ALWAYS_INLINE size_t operator*() const + _GLIBCXX_SIMD_ALWAYS_INLINE size_t + operator*() const { return __bit; } - _GLIBCXX_SIMD_ALWAYS_INLINE iterator& operator++() + _GLIBCXX_SIMD_ALWAYS_INLINE iterator& + operator++() { __reset_lsb(); __next_bit(); return *this; } - _GLIBCXX_SIMD_ALWAYS_INLINE iterator operator++(int) + _GLIBCXX_SIMD_ALWAYS_INLINE iterator + operator++(int) { iterator __tmp = *this; __reset_lsb(); @@ -3612,17 +3630,21 @@ template return __tmp; } - _GLIBCXX_SIMD_ALWAYS_INLINE bool operator==(const iterator& __rhs) const + _GLIBCXX_SIMD_ALWAYS_INLINE bool + operator==(const iterator& __rhs) const { return __mask == __rhs.__mask; } - _GLIBCXX_SIMD_ALWAYS_INLINE bool operator!=(const iterator& __rhs) const + _GLIBCXX_SIMD_ALWAYS_INLINE bool + operator!=(const iterator& __rhs) const { return __mask != __rhs.__mask; } }; - iterator begin() const + iterator + begin() const { return __bits.to_ullong(); } - iterator end() const + iterator + end() const { return 0; } }; @@ -3637,15 +3659,13 @@ template // reductions [simd.reductions] {{{1 template > _GLIBCXX_SIMD_INTRINSIC _GLIBCXX_SIMD_CONSTEXPR _Tp - reduce(const simd<_Tp, _Abi>& __v, - _BinaryOperation __binary_op = _BinaryOperation()) + reduce(const simd<_Tp, _Abi>& __v, _BinaryOperation __binary_op = _BinaryOperation()) { return _Abi::_SimdImpl::_S_reduce(__v, __binary_op); } template > _GLIBCXX_SIMD_INTRINSIC typename _V::value_type reduce(const const_where_expression<_M, _V>& __x, - typename _V::value_type __identity_element, - _BinaryOperation __binary_op) + typename _V::value_type __identity_element, _BinaryOperation __binary_op) { if (__builtin_expect(none_of(__get_mask(__x)), false)) return __identity_element; @@ -3684,16 +3704,12 @@ template template _GLIBCXX_SIMD_INTRINSIC _GLIBCXX_SIMD_CONSTEXPR _Tp hmin(const simd<_Tp, _Abi>& __v) noexcept - { - return _Abi::_SimdImpl::_S_reduce(__v, __detail::_Minimum()); - } + { return _Abi::_SimdImpl::_S_reduce(__v, __detail::_Minimum()); } template _GLIBCXX_SIMD_INTRINSIC _GLIBCXX_SIMD_CONSTEXPR _Tp hmax(const simd<_Tp, _Abi>& __v) noexcept - { - return _Abi::_SimdImpl::_S_reduce(__v, __detail::_Maximum()); - } + { return _Abi::_SimdImpl::_S_reduce(__v, __detail::_Maximum()); } template _GLIBCXX_SIMD_INTRINSIC _GLIBCXX_SIMD_CONSTEXPR @@ -3761,8 +3777,7 @@ template template _GLIBCXX_SIMD_INTRINSIC _GLIBCXX_SIMD_CONSTEXPR simd<_Tp, _Ap> - clamp(const simd<_Tp, _Ap>& __v, const simd<_Tp, _Ap>& __lo, - const simd<_Tp, _Ap>& __hi) + clamp(const simd<_Tp, _Ap>& __v, const simd<_Tp, _Ap>& __lo, const simd<_Tp, _Ap>& __hi) { using _Impl = typename _Ap::_SimdImpl; return {__private_init, @@ -3783,8 +3798,7 @@ template _SimdWrapper<_Tp, _Np / _Total * _Combine> __extract_part(const _SimdWrapper<_Tp, _Np> __x); -template +template _GLIBCXX_SIMD_INTRINSIC auto __extract_part(const _SimdTuple<_Tp, _A0, _As...>& __x); @@ -3794,7 +3808,8 @@ template struct _SizeList { template - static constexpr size_t _S_at(_SizeConstant<_I> = {}) + static constexpr size_t + _S_at(_SizeConstant<_I> = {}) { if constexpr (_I == 0) return _V0; @@ -3803,7 +3818,8 @@ template } template - static constexpr auto _S_before(_SizeConstant<_I> = {}) + static constexpr auto + _S_before(_SizeConstant<_I> = {}) { if constexpr (_I == 0) return _SizeConstant<0>(); @@ -3813,7 +3829,8 @@ template } template - static constexpr auto _S_pop_front(_SizeConstant<_Np> = {}) + static constexpr auto + _S_pop_front(_SizeConstant<_Np> = {}) { if constexpr (_Np == 0) return _SizeList(); @@ -3965,8 +3982,7 @@ template (simd_mask) {{{ template / _V::size()> + size_t _Parts = simd_size_v / _V::size()> enable_if_t && simd_size_v == _Parts * _V::size(), array<_V, _Parts>> split(const simd_mask& __x) @@ -4131,8 +4147,7 @@ template // __store_pack_of_simd {{{ template _GLIBCXX_SIMD_INTRINSIC void - __store_pack_of_simd(char* __mem, const simd<_Tp, _A0>& __x0, - const simd<_Tp, _As>&... __xs) + __store_pack_of_simd(char* __mem, const simd<_Tp, _A0>& __x0, const simd<_Tp, _As>&... __xs) { constexpr size_t __n_bytes = sizeof(_Tp) * simd_size_v<_Tp, _A0>; __builtin_memcpy(__mem, &__data(__x0), __n_bytes); @@ -4188,7 +4203,8 @@ template ) return _M_obj; @@ -4197,7 +4213,8 @@ template - _GLIBCXX_SIMD_INTRINSIC constexpr void _M_write(_Tp&& __x) const + _GLIBCXX_SIMD_INTRINSIC constexpr void + _M_write(_Tp&& __x) const { _Accessor::_S_set(_M_obj, _M_index, static_cast<_Tp&&>(__x)); } public: @@ -4207,32 +4224,32 @@ template , value_type>> - _GLIBCXX_SIMD_INTRINSIC constexpr _SmartReference operator=(_Tp&& __x) && + template , value_type>> + _GLIBCXX_SIMD_INTRINSIC constexpr _SmartReference + operator=(_Tp&& __x) && { _M_write(static_cast<_Tp&&>(__x)); return {_M_obj, _M_index}; } -#define _GLIBCXX_SIMD_OP_(__op) \ - template () __op declval<_Tp>()), \ - typename = _ValuePreservingOrInt<__remove_cvref_t<_Tp>, _TT>, \ - typename = _ValuePreservingOrInt<_TT, value_type>> \ - _GLIBCXX_SIMD_INTRINSIC constexpr _SmartReference \ - operator __op##=(_Tp&& __x) && \ - { \ - const value_type& __lhs = _M_read(); \ - _M_write(__lhs __op __x); \ - return {_M_obj, _M_index}; \ +#define _GLIBCXX_SIMD_OP_(__op) \ + template () __op declval<_Tp>()), \ + typename = _ValuePreservingOrInt<__remove_cvref_t<_Tp>, _TT>, \ + typename = _ValuePreservingOrInt<_TT, value_type>> \ + _GLIBCXX_SIMD_INTRINSIC constexpr _SmartReference \ + operator __op##=(_Tp&& __x) && \ + { \ + const value_type& __lhs = _M_read(); \ + _M_write(__lhs __op __x); \ + return {_M_obj, _M_index}; \ } _GLIBCXX_SIMD_ALL_ARITHMETICS(_GLIBCXX_SIMD_OP_); _GLIBCXX_SIMD_ALL_SHIFTS(_GLIBCXX_SIMD_OP_); @@ -4240,9 +4257,9 @@ template &>())> - _GLIBCXX_SIMD_INTRINSIC constexpr _SmartReference operator++() && + typename = decltype(++declval&>())> + _GLIBCXX_SIMD_INTRINSIC constexpr _SmartReference + operator++() && { value_type __x = _M_read(); _M_write(++__x); @@ -4250,9 +4267,9 @@ template &>()++)> - _GLIBCXX_SIMD_INTRINSIC constexpr value_type operator++(int) && + typename = decltype(declval&>()++)> + _GLIBCXX_SIMD_INTRINSIC constexpr value_type + operator++(int) && { const value_type __r = _M_read(); value_type __x = __r; @@ -4261,9 +4278,9 @@ template &>())> - _GLIBCXX_SIMD_INTRINSIC constexpr _SmartReference operator--() && + typename = decltype(--declval&>())> + _GLIBCXX_SIMD_INTRINSIC constexpr _SmartReference + operator--() && { value_type __x = _M_read(); _M_write(--__x); @@ -4271,9 +4288,9 @@ template &>()--)> - _GLIBCXX_SIMD_INTRINSIC constexpr value_type operator--(int) && + typename = decltype(declval&>()--)> + _GLIBCXX_SIMD_INTRINSIC constexpr value_type + operator--(int) && { const value_type __r = _M_read(); value_type __x = __r; @@ -4349,7 +4366,8 @@ template template