25 #ifndef _GLIBCXX_EXPERIMENTAL_SIMD_PPC_H_
26 #define _GLIBCXX_EXPERIMENTAL_SIMD_PPC_H_
28 #if __cplusplus >= 201703L
31 #error "simd_ppc.h may only be included when AltiVec/VMX is available"
34 _GLIBCXX_SIMD_BEGIN_NAMESPACE
37 template <
typename _Abi>
38 struct _SimdImplPpc : _SimdImplBuiltin<_Abi>
40 using _Base = _SimdImplBuiltin<_Abi>;
48 template <
typename _Tp,
size_t _Np>
49 _GLIBCXX_SIMD_INTRINSIC
static constexpr _SimdWrapper<_Tp, _Np>
50 _S_bit_shift_left(_SimdWrapper<_Tp, _Np> __x, _SimdWrapper<_Tp, _Np> __y)
52 __x = _Base::_S_bit_shift_left(__x, __y);
53 if constexpr (
sizeof(_Tp) <
sizeof(
int))
55 = (__y._M_data <
sizeof(_Tp) * __CHAR_BIT__) & __x._M_data;
59 template <
typename _Tp,
size_t _Np>
60 _GLIBCXX_SIMD_INTRINSIC
static constexpr _SimdWrapper<_Tp, _Np>
61 _S_bit_shift_left(_SimdWrapper<_Tp, _Np> __x,
int __y)
63 __x = _Base::_S_bit_shift_left(__x, __y);
64 if constexpr (
sizeof(_Tp) <
sizeof(
int))
66 if (__y >=
sizeof(_Tp) * __CHAR_BIT__)
74 template <
typename _Tp,
size_t _Np>
75 _GLIBCXX_SIMD_INTRINSIC
static constexpr _SimdWrapper<_Tp, _Np>
76 _S_bit_shift_right(_SimdWrapper<_Tp, _Np> __x, _SimdWrapper<_Tp, _Np> __y)
78 if constexpr (
sizeof(_Tp) <
sizeof(
int))
80 constexpr
int __nbits =
sizeof(_Tp) * __CHAR_BIT__;
81 if constexpr (is_unsigned_v<_Tp>)
82 return (__y._M_data < __nbits)
83 & _Base::_S_bit_shift_right(__x, __y)._M_data;
86 _Base::_S_masked_assign(_SimdWrapper<_Tp, _Np>(__y._M_data
89 return _Base::_S_bit_shift_right(__x, __y);
93 return _Base::_S_bit_shift_right(__x, __y);
96 template <
typename _Tp,
size_t _Np>
97 _GLIBCXX_SIMD_INTRINSIC
static constexpr _SimdWrapper<_Tp, _Np>
98 _S_bit_shift_right(_SimdWrapper<_Tp, _Np> __x,
int __y)
100 if constexpr (
sizeof(_Tp) <
sizeof(
int))
102 constexpr
int __nbits =
sizeof(_Tp) * __CHAR_BIT__;
105 if constexpr (is_unsigned_v<_Tp>)
108 return _Base::_S_bit_shift_right(__x, __nbits - 1);
111 return _Base::_S_bit_shift_right(__x, __y);
119 _GLIBCXX_SIMD_END_NAMESPACE