File indexing completed on 2025-01-30 10:25:49
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028 #ifndef VC_COMMON_SIMDARRAYFWD_H_
0029 #define VC_COMMON_SIMDARRAYFWD_H_
0030
0031 #include "../scalar/types.h"
0032 #include "../sse/types.h"
0033 #include "../avx/types.h"
0034
0035 #include "utility.h"
0036 #include "macros.h"
0037
0038 namespace Vc_VERSIONED_NAMESPACE
0039 {
0040
0041 template <class T, int N>
0042 class Vector<T, simd_abi::fixed_size<N>> : public SimdArray<T, N>
0043 {
0044 using SimdArray<T, N>::SimdArray;
0045
0046 public:
0047
0048
0049 Vc_INTRINSIC Vector(const Vector &x) : SimdArray<T, N>(x) {}
0050 Vc_INTRINSIC Vector &operator=(const Vector &x)
0051 {
0052 SimdArray<T, N>::operator=(x);
0053 return *this;
0054 }
0055 Vector() = default;
0056
0057 using abi_type = simd_abi::fixed_size<N>;
0058 using abi = abi_type;
0059
0060 Vc_DEPRECATED("use Vector([](int n) { return n; }) instead of "
0061 "Vector::IndexesFromZero()") static Vector IndexesFromZero()
0062 {
0063 return Vector([](size_t i) -> T { return i; });
0064 }
0065 Vc_DEPRECATED("use 0 instead of Vector::Zero()") static Vector Zero() { return 0; }
0066 Vc_DEPRECATED("use 1 instead of Vector::One()") static Vector One() { return 1; }
0067 };
0068
0069 template <class T, int N>
0070 class Mask<T, simd_abi::fixed_size<N>> : public SimdMaskArray<T, N>
0071 {
0072 using SimdMaskArray<T, N>::SimdMaskArray;
0073
0074 public:
0075
0076
0077 Vc_INTRINSIC Mask(const Mask &x) : SimdMaskArray<T, N>(x) {}
0078 Vc_INTRINSIC Mask &operator=(const Mask &x)
0079 {
0080 SimdMaskArray<T, N>::operator=(x);
0081 return *this;
0082 }
0083 Mask() = default;
0084
0085 using abi_type = simd_abi::fixed_size<N>;
0086 using abi = abi_type;
0087 };
0088
0089
0090
0091
0092
0093
0094 template <typename T, std::size_t N> struct SimdArrayTraits {
0095 static constexpr std::size_t N0 = Common::left_size<N>();
0096 static constexpr std::size_t N1 = Common::right_size<N>();
0097
0098 using storage_type0 = fixed_size_simd<T, N0>;
0099 using storage_type1 = fixed_size_simd<T, N1>;
0100 };
0101
0102 template <typename T, std::size_t N, typename VectorType, std::size_t VectorSize>
0103 Vc_INTRINSIC_L typename SimdArrayTraits<T, N>::storage_type0 &internal_data0(
0104 SimdArray<T, N, VectorType, VectorSize> &x) Vc_INTRINSIC_R;
0105 template <typename T, std::size_t N, typename VectorType, std::size_t VectorSize>
0106 Vc_INTRINSIC_L typename SimdArrayTraits<T, N>::storage_type1 &internal_data1(
0107 SimdArray<T, N, VectorType, VectorSize> &x) Vc_INTRINSIC_R;
0108 template <typename T, std::size_t N, typename VectorType, std::size_t VectorSize>
0109 Vc_INTRINSIC_L const typename SimdArrayTraits<T, N>::storage_type0 &internal_data0(
0110 const SimdArray<T, N, VectorType, VectorSize> &x) Vc_INTRINSIC_R;
0111 template <typename T, std::size_t N, typename VectorType, std::size_t VectorSize>
0112 Vc_INTRINSIC_L const typename SimdArrayTraits<T, N>::storage_type1 &internal_data1(
0113 const SimdArray<T, N, VectorType, VectorSize> &x) Vc_INTRINSIC_R;
0114
0115 template <typename T, std::size_t N, typename V>
0116 Vc_INTRINSIC_L V &internal_data(SimdArray<T, N, V, N> &x) Vc_INTRINSIC_R;
0117 template <typename T, std::size_t N, typename V>
0118 Vc_INTRINSIC_L const V &internal_data(const SimdArray<T, N, V, N> &x) Vc_INTRINSIC_R;
0119
0120 namespace Traits
0121 {
0122
0123 template <class T> struct is_fixed_size_simd : std::false_type {
0124 };
0125 template <class T, int N>
0126 struct is_fixed_size_simd<fixed_size_simd<T, N>> : std::true_type {
0127 };
0128 template <class T, int N>
0129 struct is_fixed_size_simd<fixed_size_simd_mask<T, N>> : std::true_type {
0130 };
0131
0132
0133 template <class T, int N>
0134 struct is_simd_vector_internal<fixed_size_simd<T, N>> : is_valid_vector_argument<T> {};
0135
0136
0137 template <class T, int N>
0138 struct is_simd_mask_internal<fixed_size_simd_mask<T, N>> : is_valid_vector_argument<T> {};
0139
0140
0141 template <typename T, std::size_t N, typename V>
0142 struct is_atomic_simdarray_internal<SimdArray<T, N, V, N>> : is_valid_vector_argument<T> {};
0143 template <typename T, int N>
0144 struct is_atomic_simdarray_internal<fixed_size_simd<T, N>>
0145 : is_atomic_simdarray_internal<SimdArray<T, N>> {
0146 };
0147
0148
0149 template <typename T, std::size_t N, typename V>
0150 struct is_atomic_simd_mask_array_internal<SimdMaskArray<T, N, V, N>>
0151 : is_valid_vector_argument<T> {
0152 };
0153 template <typename T, int N>
0154 struct is_atomic_simd_mask_array_internal<fixed_size_simd_mask<T, N>>
0155 : is_atomic_simd_mask_array_internal<SimdMaskArray<T, N>> {
0156 };
0157
0158
0159 template <typename T, std::size_t N, typename VectorType, std::size_t M>
0160 struct is_simdarray_internal<SimdArray<T, N, VectorType, M>>
0161 : is_valid_vector_argument<T> {
0162 };
0163 template <typename T, int N>
0164 struct is_simdarray_internal<fixed_size_simd<T, N>> : is_valid_vector_argument<T> {
0165 };
0166
0167
0168 template <typename T, std::size_t N, typename VectorType, std::size_t M>
0169 struct is_simd_mask_array_internal<SimdMaskArray<T, N, VectorType, M>>
0170 : is_valid_vector_argument<T> {
0171 };
0172 template <typename T, int N>
0173 struct is_simd_mask_array_internal<fixed_size_simd_mask<T, N>>
0174 : is_valid_vector_argument<T> {
0175 };
0176
0177
0178 template <typename T, std::size_t N, typename V, std::size_t M>
0179 struct is_integral_internal<SimdArray<T, N, V, M>, false> : std::is_integral<T> {
0180 };
0181
0182
0183 template <typename T, std::size_t N, typename V, std::size_t M>
0184 struct is_floating_point_internal<SimdArray<T, N, V, M>, false>
0185 : std::is_floating_point<T> {
0186 };
0187
0188
0189 template <typename T, std::size_t N, typename V, std::size_t M>
0190 struct is_signed_internal<SimdArray<T, N, V, M>, false> : std::is_signed<T> {
0191 };
0192
0193
0194 template <typename T, std::size_t N, typename V, std::size_t M>
0195 struct is_unsigned_internal<SimdArray<T, N, V, M>, false> : std::is_unsigned<T> {
0196 };
0197
0198
0199 template <typename T, std::size_t N>
0200 struct has_no_allocated_data_impl<Vc::SimdArray<T, N>> : std::true_type {
0201 };
0202
0203
0204 }
0205
0206 }
0207
0208 #endif
0209
0210