From: Matthias Kretz <m.kretz@gsi.de>
To: <gcc-patches@gcc.gnu.org>, <libstdc++@gcc.gnu.org>
Subject: [PATCH 2/2] libstdc++: Use diagnose_as attribute to improve simd diagnostics
Date: Mon, 15 Nov 2021 18:05:24 +0100 [thread overview]
Message-ID: <3470478.13IECXvHe9@excalibur> (raw)
In-Reply-To: <1849892.9kXth2LyAg@excalibur>
[-- Attachment #1: Type: text/plain, Size: 1425 bytes --]
Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
libstdc++-v3/ChangeLog:
* include/experimental/bits/simd.h: Diagnose
'std::experimental::parallelism_v2::simd_abi' as 'simd_abi'.
On x86, diagnose _VecBuiltin<16>, _VecBuiltin<32>, and
_VecBltnBtmsk<64> as 'simd_abi::[SSE]', 'simd_abi::[AVX]', and
'simd_abi::AVX512' respectively.
(simd_abi::_Scalar): Diagnose as 'simd_abi::scalar'.
(simd_abi::_Fixed): Diagnose as 'simd_abi::fixed_size<N>'.
(__odr_helper): Shorten implementation details (effectively
hiding them).
* include/experimental/bits/simd_detail.h: Diagnose
'std::experimental::parallelism_v2' as 'stdₓ'.
---
libstdc++-v3/include/experimental/bits/simd.h | 37 +++++--------------
.../include/experimental/bits/simd_detail.h | 2 +-
2 files changed, 11 insertions(+), 28 deletions(-)
--
──────────────────────────────────────────────────────────────────────────
Dr. Matthias Kretz https://mattkretz.github.io
GSI Helmholtz Centre for Heavy Ion Research https://gsi.de
stdₓ::simd
──────────────────────────────────────────────────────────────────────────
[-- Attachment #2: 0002-libstdc-Use-diagnose_as-attribute-to-improve-simd-di.patch --]
[-- Type: text/x-patch, Size: 3454 bytes --]
diff --git a/libstdc++-v3/include/experimental/bits/simd.h b/libstdc++-v3/include/experimental/bits/simd.h
index 4fbad7d67b5..f581b46fbd8 100644
--- a/libstdc++-v3/include/experimental/bits/simd.h
+++ b/libstdc++-v3/include/experimental/bits/simd.h
@@ -83,13 +83,13 @@ using __m512d [[__gnu__::__vector_size__(64)]] = double;
using __m512i [[__gnu__::__vector_size__(64)]] = long long;
#endif
-namespace simd_abi {
+namespace simd_abi [[__gnu__::__diagnose_as__("simd_abi")]] {
// simd_abi forward declarations {{{
// implementation details:
-struct _Scalar;
+ struct [[__gnu__::__diagnose_as__("scalar")]] _Scalar;
template <int _Np>
- struct _Fixed;
+ struct [[__gnu__::__diagnose_as__("fixed_size")]] _Fixed;
// There are two major ABIs that appear on different architectures.
// Both have non-boolean values packed into an N Byte register
@@ -108,28 +108,11 @@ template <int _UsedBytes>
template <int _UsedBytes>
struct _VecBltnBtmsk;
-template <typename _Tp, int _Np>
- using _VecN = _VecBuiltin<sizeof(_Tp) * _Np>;
-
-template <int _UsedBytes = 16>
- using _Sse = _VecBuiltin<_UsedBytes>;
-
-template <int _UsedBytes = 32>
- using _Avx = _VecBuiltin<_UsedBytes>;
-
-template <int _UsedBytes = 64>
- using _Avx512 = _VecBltnBtmsk<_UsedBytes>;
-
-template <int _UsedBytes = 16>
- using _Neon = _VecBuiltin<_UsedBytes>;
-
-// implementation-defined:
-using __sse = _Sse<>;
-using __avx = _Avx<>;
-using __avx512 = _Avx512<>;
-using __neon = _Neon<>;
-using __neon128 = _Neon<16>;
-using __neon64 = _Neon<8>;
+#if defined __i386__ || defined __x86_64__
+using __sse [[__gnu__::__diagnose_as__("[SSE]")]] = _VecBuiltin<16>;
+using __avx [[__gnu__::__diagnose_as__("[AVX]")]] = _VecBuiltin<32>;
+using __avx512 [[__gnu__::__diagnose_as__("[AVX512]")]] = _VecBltnBtmsk<64>;
+#endif
// standard:
template <typename _Tp, size_t _Np, typename...>
@@ -367,7 +350,7 @@ namespace __detail
* users link TUs compiled with different flags. This is especially important
* for using simd in libraries.
*/
- using __odr_helper
+ using __odr_helper [[__gnu__::__diagnose_as__("[ODR helper]")]]
= conditional_t<__machine_flags() == 0, _OdrEnforcer,
_MachineFlagsTemplate<__machine_flags(), __floating_point_flags()>>;
@@ -692,7 +675,7 @@ template <typename _Abi>
__is_avx512_abi()
{
constexpr auto _Bytes = __abi_bytes_v<_Abi>;
- return _Bytes <= 64 && is_same_v<simd_abi::_Avx512<_Bytes>, _Abi>;
+ return _Bytes <= 64 && is_same_v<simd_abi::_VecBltnBtmsk<_Bytes>, _Abi>;
}
// }}}
diff --git a/libstdc++-v3/include/experimental/bits/simd_detail.h b/libstdc++-v3/include/experimental/bits/simd_detail.h
index 198c925c133..437f1ddb278 100644
--- a/libstdc++-v3/include/experimental/bits/simd_detail.h
+++ b/libstdc++-v3/include/experimental/bits/simd_detail.h
@@ -37,7 +37,7 @@
{ \
_GLIBCXX_BEGIN_NAMESPACE_VERSION \
namespace experimental { \
- inline namespace parallelism_v2 {
+ inline namespace parallelism_v2 [[__gnu__::__diagnose_as__("std\u2093")]] {
#define _GLIBCXX_SIMD_END_NAMESPACE \
} \
} \
prev parent reply other threads:[~2021-11-15 17:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-15 17:04 [PATCH 0/2] Make use of the diagnose_as attribute to improve libstdc++ diagnostics Matthias Kretz
2021-11-15 17:05 ` [PATCH 1/2] libstdc++: Use diagnose_as attribute to improve string diagnostics Matthias Kretz
2021-11-15 17:05 ` Matthias Kretz [this message]
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=3470478.13IECXvHe9@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).