From patchwork Mon Nov 15 17:05:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matthias Kretz X-Patchwork-Id: 47688 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F36BA385BF9D for ; Mon, 15 Nov 2021 17:07:05 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from lxmtout2.gsi.de (lxmtout2.gsi.de [140.181.3.112]) by sourceware.org (Postfix) with ESMTPS id 8BC6E3857823; Mon, 15 Nov 2021 17:05:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8BC6E3857823 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gsi.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gsi.de Received: from localhost (localhost [127.0.0.1]) by lxmtout2.gsi.de (Postfix) with ESMTP id B29C82038F77; Mon, 15 Nov 2021 18:05:25 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at lxmtout2.gsi.de Received: from lxmtout2.gsi.de ([127.0.0.1]) by localhost (lxmtout2.gsi.de [127.0.0.1]) (amavisd-new, port 10024) with LMTP id m8Lr_hd9pLgM; Mon, 15 Nov 2021 18:05:25 +0100 (CET) Received: from srvex3.campus.gsi.de (unknown [10.10.4.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by lxmtout2.gsi.de (Postfix) with ESMTPS id 953DB2038F62; Mon, 15 Nov 2021 18:05:25 +0100 (CET) Received: from excalibur.localnet (140.181.3.12) by srvex3.campus.gsi.de (10.10.4.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2375.17; Mon, 15 Nov 2021 18:05:25 +0100 From: Matthias Kretz To: , Subject: [PATCH 2/2] libstdc++: Use diagnose_as attribute to improve simd diagnostics Date: Mon, 15 Nov 2021 18:05:24 +0100 Message-ID: <3470478.13IECXvHe9@excalibur> Organization: GSI Helmholtzzentrum =?utf-8?q?f=C3=BCr?= Schwerionenforschung In-Reply-To: <1849892.9kXth2LyAg@excalibur> References: <1849892.9kXth2LyAg@excalibur> MIME-Version: 1.0 X-Originating-IP: [140.181.3.12] X-ClientProxiedBy: srvex3.Campus.gsi.de (10.10.4.16) To srvex3.campus.gsi.de (10.10.4.16) X-Spam-Status: No, score=-10.4 required=5.0 tests=BAYES_00, BODY_8BITS, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H2, SPF_PASS, TXREP, T_SPF_HELO_PERMERROR autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Signed-off-by: Matthias Kretz 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'. (__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 ────────────────────────────────────────────────────────────────────────── 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 - 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 template struct _VecBltnBtmsk; -template - using _VecN = _VecBuiltin; - -template - using _Sse = _VecBuiltin<_UsedBytes>; - -template - using _Avx = _VecBuiltin<_UsedBytes>; - -template - using _Avx512 = _VecBltnBtmsk<_UsedBytes>; - -template - 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 @@ -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 __is_avx512_abi() { constexpr auto _Bytes = __abi_bytes_v<_Abi>; - return _Bytes <= 64 && is_same_v, _Abi>; + return _Bytes <= 64 && is_same_v, _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 \ } \ } \