From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lxmtout1.gsi.de (lxmtout1.gsi.de [140.181.3.111]) by sourceware.org (Postfix) with ESMTPS id 7C8F03858D3C; Fri, 2 Jun 2023 08:50:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7C8F03858D3C Authentication-Results: sourceware.org; dmarc=pass (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 lxmtout1.gsi.de (Postfix) with ESMTP id A1A7C2051044; Fri, 2 Jun 2023 10:50:34 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at lxmtout1.gsi.de Received: from lxmtout1.gsi.de ([127.0.0.1]) by localhost (lxmtout1.gsi.de [127.0.0.1]) (amavisd-new, port 10024) with LMTP id kD2So6XdIiiI; Fri, 2 Jun 2023 10:50:34 +0200 (CEST) Received: from srvEX6.campus.gsi.de (unknown [10.10.4.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lxmtout1.gsi.de (Postfix) with ESMTPS id 8ABDE2051040; Fri, 2 Jun 2023 10:50:34 +0200 (CEST) Received: from minbar.localnet (140.181.3.12) by srvEX6.campus.gsi.de (10.10.4.96) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Fri, 2 Jun 2023 10:50:34 +0200 From: Matthias Kretz To: Matthias Kretz via Libstdc++ , , Alexandre Oliva Subject: Re: [PATCH] libstdc++: Correct NTTP and simd_mask ctor call Date: Fri, 2 Jun 2023 10:50:33 +0200 Message-ID: <4768566.iIbC2pHGDl@minbar> Organization: GSI Helmholtz Centre for Heavy Ion Research In-Reply-To: References: <25353264.6Emhk5qWAg@minbar> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" X-Originating-IP: [140.181.3.12] X-ClientProxiedBy: srvEX6.Campus.gsi.de (10.10.4.96) To srvEX6.campus.gsi.de (10.10.4.96) X-Spam-Status: No, score=-10.2 required=5.0 tests=BAYES_00,BODY_8BITS,GIT_PATCH_0,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hello Alexandre, On Friday, 2 June 2023 10:32:40 CEST Alexandre Oliva wrote: > On May 26, 2023, Matthias Kretz via Libstdc++ wro= te: > > OK for master and all backports (after 11.4 is done)? > > tested on powerpc64le-linux-gnu and x86_64-pc-linux-gnu > >=20 > > * testsuite/experimental/simd/pr109822_cast_functions.cc: New > > test. >=20 > This testcase fails to compile on PowerPC targets without VSX: 64-bit > integer and floating-point types cannot be vectorized. Yes, and the simd implementation already encodes that both in=20 __vectorized_sizeof() and __intrinsic_type. > I wonder if the test is malformed (and should be amended to test for > available simd types), or whether a patch like this would be desirable > to make simd constructs more portable. I'm not sure about the > requirements. The test is correct. The stdx::simd implementation has a latent bug (my=20 dejagnu boards included only POWER7-POWER9; I'm at POWER5-POWER10 by now). = The=20 _S_store function is trying to work around bad code-gen but fails to notice= =20 that long long vectors can't be used. I'm looking at that function again, also in light of recent improvements wr= t.=20 code-gen, and will remove that assumption, that long long is vectorizable. __intrinsic_type_t should never be T, but always the type that can be=20 passed to corresponding platform intrinsics. There are traits for the=20 implementation to detect whether the intrinsics types are available. =2D Matthias >=20 >=20 > [libstdc++] [simd] [ppc] use nonvector intrinsic fallback types >=20 > From: Alexandre Oliva >=20 > Compiling such tests as pr109822_cast_functions.cc on powerpc targets > that don't support VSX fails because some intrinsic types that are > expected to be vectorizable are not defined without VSX. >=20 > Introduce fallback non-vector types to enable the code to compile. >=20 >=20 > for libstdc++-v3/ChangeLog >=20 > * include/experimental/bits/simd.h: Introduce fallback > non-vector intrinsic_type_impl specializations for PowerPC > without VSX. > --- > libstdc++-v3/include/experimental/bits/simd.h | 12 ++++++++++++ > 1 file changed, 12 insertions(+) >=20 > diff --git a/libstdc++-v3/include/experimental/bits/simd.h > b/libstdc++-v3/include/experimental/bits/simd.h index > 834fe923065bd..2691823e869e8 100644 > --- a/libstdc++-v3/include/experimental/bits/simd.h > +++ b/libstdc++-v3/include/experimental/bits/simd.h > @@ -2431,9 +2431,14 @@ template > #define _GLIBCXX_SIMD_PPC_INTRIN(_Tp) = =20 > \ template <> = =20 > \ struct __intrinsic_type_impl<_Tp> { using type =3D __vector _Tp; } > +#define _GLIBCXX_SIMD_PPC_INTRIN_NOVEC(_Tp) =09 \ > + template <> = =20 > \ + struct __intrinsic_type_impl<_Tp> { using type =3D _Tp; } > _GLIBCXX_SIMD_PPC_INTRIN(float); > #ifdef __VSX__ > _GLIBCXX_SIMD_PPC_INTRIN(double); > +#else > +_GLIBCXX_SIMD_PPC_INTRIN_NOVEC(double); > #endif > _GLIBCXX_SIMD_PPC_INTRIN(signed char); > _GLIBCXX_SIMD_PPC_INTRIN(unsigned char); > @@ -2444,12 +2449,19 @@ _GLIBCXX_SIMD_PPC_INTRIN(unsigned int); > #if defined __VSX__ || __SIZEOF_LONG__ =3D=3D 4 > _GLIBCXX_SIMD_PPC_INTRIN(signed long); > _GLIBCXX_SIMD_PPC_INTRIN(unsigned long); > +#else > +_GLIBCXX_SIMD_PPC_INTRIN_NOVEC(signed long); > +_GLIBCXX_SIMD_PPC_INTRIN_NOVEC(unsigned long); > #endif > #ifdef __VSX__ > _GLIBCXX_SIMD_PPC_INTRIN(signed long long); > _GLIBCXX_SIMD_PPC_INTRIN(unsigned long long); > +#else > +_GLIBCXX_SIMD_PPC_INTRIN_NOVEC(signed long long); > +_GLIBCXX_SIMD_PPC_INTRIN_NOVEC(unsigned long long); > #endif > #undef _GLIBCXX_SIMD_PPC_INTRIN > +#undef _GLIBCXX_SIMD_PPC_INTRIN_NOVEC >=20 > template > struct __intrinsic_type<_Tp, _Bytes, enable_if_t<__is_vectorizable_v<_= Tp> > && _Bytes <=3D 16>> =2D-=20 =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80 Dr. Matthias Kretz https://mattkretz.github.io GSI Helmholtz Centre for Heavy Ion Research https://gsi.de std=E2=82=93::simd =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80