public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/aoliva/heads/testme)] libstdc++: ppc: conditionalize vsx-only simd intrinsics
@ 2022-04-27 21:29 Alexandre Oliva
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Oliva @ 2022-04-27 21:29 UTC (permalink / raw)
  To: gcc-cvs, libstdc++-cvs

https://gcc.gnu.org/g:0179889ca6cb62f3a83eece8e484ee58e87ccddf

commit 0179889ca6cb62f3a83eece8e484ee58e87ccddf
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Wed Apr 27 18:23:04 2022 -0300

    libstdc++: ppc: conditionalize vsx-only simd intrinsics
    
    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
    support.
    
    
    for  libstdc++-v3/ChangeLog
    
            * include/experimental/bits/simd.h [__ALTIVEC__]: Require VSX
            for double, long long, and 64-bit long and 64-bit long double
            intrinsic types.

Diff:
---
 libstdc++-v3/include/experimental/bits/simd.h | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/include/experimental/bits/simd.h b/libstdc++-v3/include/experimental/bits/simd.h
index 82e9841195e..66c07127ec4 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; }
 _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__ == 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
 
 template <typename _Tp, size_t _Bytes>
@@ -2452,8 +2458,9 @@ template <typename _Tp, size_t _Bytes>
     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) == sizeof(double))),
+		  "no __intrinsic_type support for [long] double on PPC w/o VSX");
 #endif
     using type =
       typename __intrinsic_type_impl<


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [gcc(refs/users/aoliva/heads/testme)] libstdc++: ppc: conditionalize vsx-only simd intrinsics
@ 2022-05-03  0:44 Alexandre Oliva
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Oliva @ 2022-05-03  0:44 UTC (permalink / raw)
  To: gcc-cvs, libstdc++-cvs

https://gcc.gnu.org/g:c09129e592fbb30ef07cc3f590a131c680b949ff

commit c09129e592fbb30ef07cc3f590a131c680b949ff
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Wed Apr 27 18:23:04 2022 -0300

    libstdc++: ppc: conditionalize vsx-only simd intrinsics
    
    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
    support.
    
    
    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.

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 82e9841195e..349726a16d7 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; }
 _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__ == 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
 
 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");
 #endif
     using type =
       typename __intrinsic_type_impl<


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-03  0:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-27 21:29 [gcc(refs/users/aoliva/heads/testme)] libstdc++: ppc: conditionalize vsx-only simd intrinsics Alexandre Oliva
2022-05-03  0:44 Alexandre Oliva

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