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 6A0973857363; Thu, 28 Apr 2022 13:56:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6A0973857363 Received: from localhost (localhost [127.0.0.1]) by lxmtout1.gsi.de (Postfix) with ESMTP id 11C802051064; Thu, 28 Apr 2022 15:56:20 +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 urddnn_CSK6j; Thu, 28 Apr 2022 15:56:19 +0200 (CEST) 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 lxmtout1.gsi.de (Postfix) with ESMTPS id EBBAA2051040; Thu, 28 Apr 2022 15:56:19 +0200 (CEST) Received: from minbar.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.24; Thu, 28 Apr 2022 15:56:19 +0200 From: Matthias Kretz To: CC: , Segher Boessenkool , David Edelsohn , Alexandre Oliva Subject: Re: [PATCH] libstdc++: ppc: conditionalize vsx-only simd intrinsics Date: Thu, 28 Apr 2022 15:56:18 +0200 Message-ID: <15649943.RDIVbhacDa@minbar> Organization: GSI Helmholtz Centre for Heavy Ion Research In-Reply-To: References: 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: srvex1.Campus.gsi.de (10.10.4.11) To srvex3.campus.gsi.de (10.10.4.16) X-Spam-Status: No, score=-10.1 required=5.0 tests=BAYES_00, BODY_8BITS, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP 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: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Apr 2022 13:56:23 -0000 On Thursday, 28 April 2022 08:09:54 CEST Alexandre Oliva via Gcc-patches=20 wrote: > libstdc++'s bits/simd.h section for PPC (Altivec) defines various > intrinsic vector types that are only available along with VSX: 64-bit > long double, double, (un)signed long long, and 64-bit (un)signed long. Oh, so uttering `__vector double` is ill-formed (now) without VSX? I'm fair= ly=20 certain I tested without VSX and the __intrinsic_type_impl definitions were= =20 fine. > experimental/simd/standard_abi_usable{,_2}.cc tests error out reporting > the unmet requirements when the target cpu doesn't enable VSX. Make the > reported instrinsic types conditional on VSX so that > can be used on ppc variants that do not have VSX support. IIRC this will break other valid uses. You'd have to run `make check-simd`= =20 (see libstdc++-v3/testsuite/experimental/simd/README.md) to be certain noth= ing=20 breaks. I will also take a look. > Regstrapped on powerpc64el-linux-gnu. Ok to install? >=20 > This is also relevant for gcc-11. Tested with > x86_64-linux-gnu-x-ppc64-vx7r2. Ok for gcc-11? >=20 >=20 > for libstdc++-v3/ChangeLog >=20 > * include/experimental/bits/simd.h [__ALTIVEC__]: Require VSX > for double, long long, and 64-bit long and 64-bit long double > intrinsic types. > --- > libstdc++-v3/include/experimental/bits/simd.h | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) >=20 > diff --git a/libstdc++-v3/include/experimental/bits/simd.h > b/libstdc++-v3/include/experimental/bits/simd.h index > 82e9841195e1d..66c07127ec435 100644 > --- a/libstdc++-v3/include/experimental/bits/simd.h > +++ b/libstdc++-v3/include/experimental/bits/simd.h > @@ -2430,17 +2430,23 @@ template > template <> = =20 > \ struct __intrinsic_type_impl<_Tp> { using type =3D __vector _Tp; } > _GLIBCXX_SIMD_PPC_INTRIN(float); > +# ifdef __VSX__ > _GLIBCXX_SIMD_PPC_INTRIN(double); > +# endif > _GLIBCXX_SIMD_PPC_INTRIN(signed char); > _GLIBCXX_SIMD_PPC_INTRIN(unsigned char); > _GLIBCXX_SIMD_PPC_INTRIN(signed short); > _GLIBCXX_SIMD_PPC_INTRIN(unsigned short); > _GLIBCXX_SIMD_PPC_INTRIN(signed int); > _GLIBCXX_SIMD_PPC_INTRIN(unsigned int); > +# if defined __VSX__ || __LONG_WIDTH__ =3D=3D 32 > _GLIBCXX_SIMD_PPC_INTRIN(signed long); > _GLIBCXX_SIMD_PPC_INTRIN(unsigned long); > +# endif > +# ifdef __VSX__ > _GLIBCXX_SIMD_PPC_INTRIN(signed long long); > _GLIBCXX_SIMD_PPC_INTRIN(unsigned long long); > +# endif > #undef _GLIBCXX_SIMD_PPC_INTRIN >=20 > template > @@ -2452,8 +2458,9 @@ template > static_assert(!(_S_is_ldouble && sizeof(long double) > sizeof(double= )), > "no __intrinsic_type support for long double on PPC"); > #ifndef __VSX__ > - static_assert(!is_same_v<_Tp, double>, > - "no __intrinsic_type support for double on PPC w/o VSX"); > + static_assert(!(is_same_v<_Tp, double> > + || (_S_is_ldouble && sizeof(long double) =3D=3D=20 sizeof(double))), > + "no __intrinsic_type support for [long] double on PPC w/o=20 VSX"); The missing condition here was an incorrect omission. With -mlong-double-64= =20 and without VSX no assertion caught the issue. IIRC, a user won't get to see this error message unless there's a bug in th= e=20 simd library implementation, so the error message is good enough for me. (I= t's=20 talking about __intrinsic_type, the user would be lost in any case.) > #endif > using type =3D > typename __intrinsic_type_impl< =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