From: Matthias Kretz <m.kretz@gsi.de>
To: <gcc-patches@gcc.gnu.org>, <libstdc++@gcc.gnu.org>
Subject: [PATCH 06/11] libstdc++: Minor simd_math cleanups
Date: Tue, 8 Jun 2021 14:11:48 +0200 [thread overview]
Message-ID: <2406752.iraNtQ3XgV@excalibur> (raw)
In-Reply-To: <270527782.u9WJ3AIrlG@excalibur>
[-- Attachment #1: Type: text/plain, Size: 1183 bytes --]
From: Matthias Kretz <kretz@kde.org>
Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
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.
---
.../include/experimental/bits/simd_math.h | 22 +++++--------------
1 file changed, 6 insertions(+), 16 deletions(-)
--
──────────────────────────────────────────────────────────────────────────
Dr. Matthias Kretz https://mattkretz.github.io
GSI Helmholtz Centre for Heavy Ion Research https://gsi.de
std::experimental::simd https://github.com/VcDevel/std-simd
──────────────────────────────────────────────────────────────────────────
[-- Attachment #2: 0006-libstdc-Minor-simd_math-cleanups.patch --]
[-- Type: text/x-patch, Size: 2308 bytes --]
diff --git a/libstdc++-v3/include/experimental/bits/simd_math.h b/libstdc++-v3/include/experimental/bits/simd_math.h
index cff4371619d..a5df2039970 100644
--- a/libstdc++-v3/include/experimental/bits/simd_math.h
+++ b/libstdc++-v3/include/experimental/bits/simd_math.h
@@ -645,11 +645,8 @@ template <typename _Tp, typename _Abi>
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 <typename _Tp, typename _Abi>
_Abi::_CommonImpl::_S_blend(_SimdWrapper<bool, _Np>(
__isnonzero),
__v, __getmant_avx512(__v))};
-#endif // _GLIBCXX_SIMD_X86INTRIN
}
+#endif // _GLIBCXX_SIMD_X86INTRIN
else
{
// fallback implementation
@@ -749,14 +746,7 @@ template <typename _Tp, typename _Abi>
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,
@@ -827,9 +817,7 @@ template <typename _Tp, typename _Abi>
enable_if_t<is_floating_point_v<_Tp>, 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);
@@ -1472,6 +1460,8 @@ template <typename _Tp, typename _Abi>
}
// }}}
+#undef _GLIBCXX_SIMD_CVTING2
+#undef _GLIBCXX_SIMD_CVTING3
#undef _GLIBCXX_SIMD_MATH_CALL_
#undef _GLIBCXX_SIMD_MATH_CALL2_
#undef _GLIBCXX_SIMD_MATH_CALL3_
next prev parent reply other threads:[~2021-06-08 12:11 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-08 12:10 [PATCH 00/11] stdx::simd optimizations, corrections, and cleanups Matthias Kretz
2021-06-08 12:11 ` [PATCH 01/11] libstdc++: Improve copysign codegen Matthias Kretz
2021-06-08 12:11 ` [PATCH 02/11] libstdc++: Remove dead code Matthias Kretz
2021-06-08 12:11 ` [PATCH 03/11] libstdc++: Improve fixed_size codegen Matthias Kretz
2021-06-08 12:11 ` [PATCH 04/11] libstdc++: Make use of __builtin_bit_cast Matthias Kretz
2021-06-11 10:53 ` [PATCH 04/11 v2] " Matthias Kretz
2021-06-24 14:01 ` [PATCH 04/11 v3] " Matthias Kretz
2021-06-24 14:08 ` Jakub Jelinek
2021-06-24 14:11 ` Jonathan Wakely
2021-06-24 14:12 ` Jonathan Wakely
2021-06-24 14:21 ` Jakub Jelinek
2021-06-24 14:34 ` Jonathan Wakely
2021-06-24 14:40 ` Jonathan Wakely
2021-06-24 14:44 ` Jakub Jelinek
2021-06-25 11:23 ` Jonathan Wakely
2021-06-08 12:11 ` [PATCH 05/11] libstdc++: Remove incorrect fabs overload Matthias Kretz
2021-06-08 12:11 ` Matthias Kretz [this message]
2021-06-08 12:11 ` [PATCH 07/11] libstdc++: Fix condition when AVX512F ldexp implementation is used Matthias Kretz
2021-06-08 12:11 ` [PATCH 08/11] libstdc++: Avoid raising fp exceptions in trunc, floor, and ceil Matthias Kretz
2021-06-08 12:11 ` [PATCH 09/11] libstdc++: Ensure unrolled loops inline the lambda Matthias Kretz
2021-06-08 12:12 ` [PATCH 10/11] libstdc++: Fix internal names: add missing underscores Matthias Kretz
2021-06-08 12:12 ` [PATCH 11/11] libstdc++: Fix ODR issues with different -m flags Matthias Kretz
2021-06-09 12:22 ` Richard Biener
2021-06-09 12:53 ` Matthias Kretz
2021-06-09 13:22 ` Richard Biener
2021-11-15 8:57 ` Matthias Kretz
2022-01-14 21:30 ` Jonathan Wakely
2022-01-17 0:08 ` Jonathan Wakely
2021-06-24 13:42 ` [PATCH 00/11] stdx::simd optimizations, corrections, and cleanups Jonathan Wakely
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2406752.iraNtQ3XgV@excalibur \
--to=m.kretz@gsi.de \
--cc=gcc-patches@gcc.gnu.org \
--cc=libstdc++@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).