| 1 |
// { dg-do compile } |
| 2 |
// { dg-options "-O -w -g1 -std=gnu++20 -fchecking" } |
| 3 |
|
| 4 |
template <int __v> struct integral_constant { |
| 5 |
static constexpr int value = __v; |
| 6 |
}; |
| 7 |
struct __conjunction_impl { |
| 8 |
using type = integral_constant<1>; |
| 9 |
}; |
| 10 |
template <bool, typename _Iftrue, typename> using conditional_t = _Iftrue; |
| 11 |
template <int> struct _Fixed; |
| 12 |
template <int> struct _VecBuiltin; |
| 13 |
template <int _Np> using fixed_size = _Fixed<_Np>; |
| 14 |
template <typename...> struct _SimdTuple; |
| 15 |
template <int> struct __fixed_size_storage; |
| 16 |
template <typename, int _Np> |
| 17 |
using __fixed_size_storage_t = __fixed_size_storage<_Np>::type; |
| 18 |
struct _SimdWrapperBase { |
| 19 |
[[__gnu__::__artificial__]] constexpr _SimdWrapperBase(int); |
| 20 |
}; |
| 21 |
struct _SimdWrapper : _SimdWrapperBase { |
| 22 |
using _SimdWrapperBase::_SimdWrapperBase; |
| 23 |
}; |
| 24 |
template <unsigned long> struct __deduce_impl; |
| 25 |
template <typename, long _Np> using deduce_t = __deduce_impl<_Np>::type; |
| 26 |
template <template <int> class _Abi, int _Bytes> struct __find_next_valid_abi { |
| 27 |
static auto _S_choose() { return _Abi<_Bytes>(); } |
| 28 |
using type = decltype(_S_choose()); |
| 29 |
}; |
| 30 |
template <template <int> class...> struct _AbiList; |
| 31 |
const int _S_determine_best_abi__Bytes = sizeof(int); |
| 32 |
template <template <int> class _A0, template <int> class... _Rest> |
| 33 |
struct _AbiList<_A0, _Rest...> { |
| 34 |
template <typename, int> static auto _S_determine_best_abi() { |
| 35 |
return typename __find_next_valid_abi<_A0, |
| 36 |
_S_determine_best_abi__Bytes>::type{}; |
| 37 |
} |
| 38 |
template <typename _Tp, int _Np> |
| 39 |
using _BestAbi = decltype(_S_determine_best_abi<_Tp, _Np>()); |
| 40 |
}; |
| 41 |
template <typename _Abi> struct _SimdTraits : _Abi::__traits<int> {}; |
| 42 |
template <int _Np> struct __deduce_fixed_size_fallback { |
| 43 |
using type = fixed_size<_Np>; |
| 44 |
}; |
| 45 |
template <unsigned long _Np> |
| 46 |
struct __deduce_impl : __deduce_fixed_size_fallback<_Np> {}; |
| 47 |
template <typename _Abi> struct simd { |
| 48 |
using _Traits = _SimdTraits<_Abi>; |
| 49 |
using _Impl = _Traits::_SimdImpl; |
| 50 |
using abi_type = _Abi; |
| 51 |
template <typename _Up> simd(_Up __x) : _M_data(_Impl::_S_broadcast(__x)) {} |
| 52 |
friend void operator!=(simd, simd); |
| 53 |
_Traits::_SimdMember _M_data; |
| 54 |
}; |
| 55 |
struct _SimdTupleData { |
| 56 |
_SimdWrapper second; |
| 57 |
}; |
| 58 |
template <typename _Tp, typename _Abi0, typename... _Abis> |
| 59 |
struct _SimdTuple<_Tp, _Abi0, _Abis...> : _SimdTupleData { |
| 60 |
template <typename _Fp> static _SimdTuple _S_generate(_Fp) { return {0}; } |
| 61 |
}; |
| 62 |
template <typename _Tp, int _Np, typename, |
| 63 |
typename = simd<_AbiList<_VecBuiltin>::_BestAbi<_Tp, _Np>>> |
| 64 |
struct __fixed_size_storage_builder; |
| 65 |
template <int _Np> |
| 66 |
struct __fixed_size_storage |
| 67 |
: __fixed_size_storage_builder<long, _Np, _SimdTuple<>> {}; |
| 68 |
template <typename _Tp, int _Np, typename... _As, typename _Next> |
| 69 |
struct __fixed_size_storage_builder<_Tp, _Np, _SimdTuple<_As...>, _Next> { |
| 70 |
using type = _SimdTuple<_Tp, typename _Next::abi_type>; |
| 71 |
}; |
| 72 |
template <int _Np> struct _SimdImplFixedSize { |
| 73 |
template <typename _Tp> using _SimdMember = __fixed_size_storage_t<_Tp, _Np>; |
| 74 |
template <typename _Tp> static _SimdMember<_Tp> _S_broadcast(_Tp) { |
| 75 |
return _SimdMember<_Tp>::_S_generate([] {}); |
| 76 |
} |
| 77 |
}; |
| 78 |
template <int _Np> struct _Fixed { |
| 79 |
template <typename> struct __traits { |
| 80 |
using _SimdImpl = _SimdImplFixedSize<_Np>; |
| 81 |
using _SimdMember = __fixed_size_storage_t<int, _Np>; |
| 82 |
}; |
| 83 |
}; |
| 84 |
struct _GnuTraits { |
| 85 |
using _SimdImpl = long; |
| 86 |
using _SimdMember = _SimdWrapper; |
| 87 |
}; |
| 88 |
template <int> struct _VecBuiltin { |
| 89 |
template <typename> |
| 90 |
static constexpr bool _S_is_valid_v = __conjunction_impl::type ::value; |
| 91 |
template <typename _Tp> |
| 92 |
using __traits = conditional_t<_S_is_valid_v<_Tp>, _GnuTraits, int>; |
| 93 |
}; |
| 94 |
template <typename U, int N> using V = simd<deduce_t<U, N>>; |
| 95 |
void reduce(V<long, 4> x) { x != 1; } |