public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
From: Alexandre Oliva <aoliva@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc r11-9990] libstdc++: ppc: conditionalize vsx-only simd intrinsics
Date: Fri, 13 May 2022 06:09:50 +0000 (GMT)	[thread overview]
Message-ID: <20220513060950.089393858C2D@sourceware.org> (raw)

https://gcc.gnu.org/g:9151de4b43bfb48202ee815924738197ac6e76a3

commit r11-9990-g9151de4b43bfb48202ee815924738197ac6e76a3
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Fri May 13 03:08:31 2022 -0300

    libstdc++: ppc: conditionalize vsx-only simd intrinsics
    
    libstdc++'s bits/simd.h section for PowerPC, guarded by __ALTIVEC__,
    defines various intrinsic vector types that are only available 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 PowerPC variants that do not
    support VSX.
    
    
    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.
    
    (cherry picked from commit 469c76f0d94d03e29467a9d1e77cd3613f46ac2f)

Diff:
---
 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 421c923e7b0..0e58ae01b17 100644
--- a/libstdc++-v3/include/experimental/bits/simd.h
+++ b/libstdc++-v3/include/experimental/bits/simd.h
@@ -2303,17 +2303,23 @@ template <typename _Tp>
   template <>                                                                  \
     struct __intrinsic_type_impl<_Tp> { using type = __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__ || __SIZEOF_LONG__ == 4
 _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
 
 template <typename _Tp, size_t _Bytes>
@@ -2323,10 +2329,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 PowerPC");
 #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 PowerPC w/o VSX");
 #endif
     using type =
       typename __intrinsic_type_impl<


                 reply	other threads:[~2022-05-13  6:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220513060950.089393858C2D@sourceware.org \
    --to=aoliva@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@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).