From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 9C596388801F; Thu, 24 Jun 2021 13:34:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9C596388801F MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r12-1784] libstdc++: Minor simd_math cleanups X-Act-Checkin: gcc X-Git-Author: Matthias Kretz X-Git-Refname: refs/heads/master X-Git-Oldrev: dd1c7792d6ff70e830e0ff8028bbac8379f5a79c X-Git-Newrev: 62a989ea66e8b1d4c3ed4218c5115e050072711a Message-Id: <20210624133433.9C596388801F@sourceware.org> Date: Thu, 24 Jun 2021 13:34:33 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Jun 2021 13:34:33 -0000 https://gcc.gnu.org/g:62a989ea66e8b1d4c3ed4218c5115e050072711a commit r12-1784-g62a989ea66e8b1d4c3ed4218c5115e050072711a Author: Matthias Kretz Date: Thu Jun 24 14:20:15 2021 +0100 libstdc++: Minor simd_math cleanups Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: * include/experimental/bits/simd_math.h: Undefine internal macros after use. (frexp): Move #if to a more sensible position and reformat preceding code. (logb): Call _SimdImpl::_S_logb for fixed_size instead of duplicating the code here. (modf): Simplify condition. Diff: --- libstdc++-v3/include/experimental/bits/simd_math.h | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/libstdc++-v3/include/experimental/bits/simd_math.h b/libstdc++-v3/include/experimental/bits/simd_math.h index fe670e60961..80b6e2b4cb5 100644 --- a/libstdc++-v3/include/experimental/bits/simd_math.h +++ b/libstdc++-v3/include/experimental/bits/simd_math.h @@ -645,11 +645,8 @@ template return __r; } else if constexpr (__is_fixed_size_abi_v<_Abi>) - { - return {__private_init, - _Abi::_SimdImpl::_S_frexp(__data(__x), __data(*__exp))}; + return {__private_init, _Abi::_SimdImpl::_S_frexp(__data(__x), __data(*__exp))}; #if _GLIBCXX_SIMD_X86INTRIN - } else if constexpr (__have_avx512f) { constexpr size_t _Np = simd_size_v<_Tp, _Abi>; @@ -667,8 +664,8 @@ template _Abi::_CommonImpl::_S_blend(_SimdWrapper( __isnonzero), __v, __getmant_avx512(__v))}; -#endif // _GLIBCXX_SIMD_X86INTRIN } +#endif // _GLIBCXX_SIMD_X86INTRIN else { // fallback implementation @@ -751,14 +748,7 @@ template if constexpr (_Np == 1) return std::logb(__x[0]); else if constexpr (__is_fixed_size_abi_v<_Abi>) - { - return {__private_init, - __data(__x)._M_apply_per_chunk([](auto __impl, auto __xx) { - using _V = typename decltype(__impl)::simd_type; - return __data( - std::experimental::logb(_V(__private_init, __xx))); - })}; - } + return {__private_init, _Abi::_SimdImpl::_S_logb(__data(__x))}; #if _GLIBCXX_SIMD_X86INTRIN // {{{ else if constexpr (__have_avx512vl && __is_sse_ps<_Tp, _Np>()) return {__private_init, @@ -829,9 +819,7 @@ template enable_if_t, simd<_Tp, _Abi>> modf(const simd<_Tp, _Abi>& __x, simd<_Tp, _Abi>* __iptr) { - if constexpr (__is_scalar_abi<_Abi>() - || (__is_fixed_size_abi_v< - _Abi> && simd_size_v<_Tp, _Abi> == 1)) + if constexpr (simd_size_v<_Tp, _Abi> == 1) { _Tp __tmp; _Tp __r = std::modf(__x[0], &__tmp); @@ -1474,6 +1462,8 @@ template } // }}} +#undef _GLIBCXX_SIMD_CVTING2 +#undef _GLIBCXX_SIMD_CVTING3 #undef _GLIBCXX_SIMD_MATH_CALL_ #undef _GLIBCXX_SIMD_MATH_CALL2_ #undef _GLIBCXX_SIMD_MATH_CALL3_