public inbox for
 help / color / mirror / Atom feed
From: Alexandre Oliva <>
To: Segher Boessenkool <>
	David Edelsohn <>
Subject: [PATCH v2] libstdc++: ppc: conditionalize vsx-only simd intrinsics
Date: Mon, 02 May 2022 23:00:02 -0300	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <> (Segher Boessenkool's message of "Mon, 2 May 2022 16:36:19 -0500")

On May  2, 2022, Segher Boessenkool <> wrote:

> Send full patches always please.

I'll try to remember that.  In case I fail, I hope you won't mind too
much reminding me.

(You'd also asked me not to send patches as followups, but...  revised
versions of a patch still belong in the same thread, right?)

Here's the updated full patch.  I tried to find earlier references to
this partial specialization of template struct __intrinsic_type in
ChangeLogs, to no avail.  (That was why I went for the more abstract
ChangeLog entry before.)

libstdc++: ppc: conditionalize vsx-only simd intrinsics

From: Alexandre Oliva <>

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.

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
<experimental/simd> can be used on ppc variants that do not have VSX

Regstrapping on powerpc64le-linux-gnu.  Ok for trunk?  gcc-12?  gcc-11?

for  libstdc++-v3/ChangeLog

	* include/experimental/bits/simd.h [__ALTIVEC__]: Require VSX
	for double, long long, and 64-bit long intrinsic types.
	[__ALTIVEC__] (__intrinsic_type): Mention 128-bit in
	preexisting long double diagnostic, adjust no-VSX double
	diagnostic to cover 64-bit long double as well.
 libstdc++-v3/include/experimental/bits/simd.h |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/libstdc++-v3/include/experimental/bits/simd.h b/libstdc++-v3/include/experimental/bits/simd.h
index 82e9841195e1d..349726a16d71c 100644
--- a/libstdc++-v3/include/experimental/bits/simd.h
+++ b/libstdc++-v3/include/experimental/bits/simd.h
@@ -2430,17 +2430,23 @@ template <typename _Tp>
   template <>                                                                  \
     struct __intrinsic_type_impl<_Tp> { using type = __vector _Tp; }
+#ifdef __VSX__
 _GLIBCXX_SIMD_PPC_INTRIN(unsigned char);
 _GLIBCXX_SIMD_PPC_INTRIN(signed short);
 _GLIBCXX_SIMD_PPC_INTRIN(unsigned short);
 _GLIBCXX_SIMD_PPC_INTRIN(unsigned int);
+#if defined __VSX__ || __LONG_WIDTH__ == 32
 _GLIBCXX_SIMD_PPC_INTRIN(unsigned long);
+#ifdef __VSX__
 _GLIBCXX_SIMD_PPC_INTRIN(signed long long);
 _GLIBCXX_SIMD_PPC_INTRIN(unsigned long long);
 template <typename _Tp, size_t _Bytes>
@@ -2450,10 +2456,11 @@ template <typename _Tp, size_t _Bytes>
     static constexpr bool _S_is_ldouble = is_same_v<_Tp, long double>;
     // allow _Tp == long double with -mlong-double-64
     static_assert(!(_S_is_ldouble && sizeof(long double) > sizeof(double)),
-		  "no __intrinsic_type support for long double on PPC");
+		  "no __intrinsic_type support for 128-bit floating point 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) == sizeof(double))),
+		  "no __intrinsic_type support for 64-bit floating point on PPC w/o VSX");
     using type =
       typename __intrinsic_type_impl<

Alexandre Oliva, happy hacker      
   Free Software Activist                       GNU Toolchain Engineer
Disinformation flourishes because many people care deeply about injustice
but very few check the facts.  Ask me about <>

  reply	other threads:[~2022-05-03  2:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-28  6:09 [PATCH] " Alexandre Oliva
2022-04-28 13:03 ` Segher Boessenkool
2022-04-29  1:53   ` Alexandre Oliva
2022-04-29 18:44     ` Matthias Kretz
2022-05-02 21:36     ` Segher Boessenkool
2022-05-03  2:00       ` Alexandre Oliva [this message]
2022-05-06 16:14         ` [PATCH v2] " Segher Boessenkool
2022-05-06 17:05           ` Jonathan Wakely
2022-05-06 18:24             ` [PATCH v3] " Alexandre Oliva
2022-04-28 13:56 ` [PATCH] " Matthias Kretz
2022-04-28 16:06   ` Segher Boessenkool

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \

* 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).