28#ifndef VC_COMMON_VECTOR_H_
29#define VC_COMMON_VECTOR_H_
32#include "elementreference.h"
35#include "vectortraits.h"
36#include "simdarrayfwd.h"
37#include "loadstoreflags.h"
38#include "writemaskedvector.h"
41namespace Vc_VERSIONED_NAMESPACE
54template <
typename T,
typename Abi,
55 typename = enable_if<std::is_floating_point<T>::value &&
56 !detail::is_fixed_size_abi<Abi>::value>>
92template <
typename T,
typename Abi,
93 typename = enable_if<std::is_floating_point<T>::value &&
94 !detail::is_fixed_size_abi<Abi>::value>>
104template <
typename T,
typename Abi>
108 return x < Vector<T, Abi>::Zero();
125template<
typename T,
typename Abi = VectorAbi::Best<T>>
class Vector
142 static constexpr size_t size() {
return VectorTraits<T, Abi>::size(); }
154 using EntryType =
typename VectorTraits<T, Abi>::EntryType;
158 using VectorEntryType =
typename VectorTraits<T, Abi>::VectorEntryType;
162 using VectorType =
typename VectorTraits<T, Abi>::VectorType;
166 using vector_type = VectorType;
174 using VectorArgument =
Vector;
181 using reference = Detail::ElementReference<Vector>;
237 explicit inline Vector(VectorSpecialInitializerZero);
244 explicit inline Vector(VectorSpecialInitializerOne);
251 explicit inline Vector(VectorSpecialInitializerIndexesFromZero);
259 template <
typename U>
261 enable_if<Traits::is_implicit_cast_allowed<U, T>::value> = nullarg);
274 template <
typename U>
275 Vc_DEPRECATED(
"use simd_cast instead of explicit type casting to convert between "
278 enable_if<!Traits::is_implicit_cast_allowed<U, T>::value> = nullarg);
289 template <
typename U>
290 inline Vector(U a, enable_if<std::is_same<U, int>::value &&
291 !std::is_same<U, EntryType>::value> = nullarg);
292 inline explicit Vector(reference a);
299#include "../common/loadinterface.h"
300#include "../common/storeinterface.h"
338#define Vc_CURRENT_CLASS_NAME Vector
339#include "../common/gatherinterface.h"
340#include "../common/scatterinterface.h"
341#undef Vc_CURRENT_CLASS_NAME
408 inline Vector &operator++();
409 inline Vector operator++(
int);
410 inline Vector &operator--();
411 inline Vector operator--(
int);
414#define Vc_OP(symbol) \
415 inline Vc_PURE Vector operator symbol(const Vector &x) const;
442 Vc_ALL_ARITHMETICS(Vc_OP);
464 Vc_ALL_BINARY(Vc_OP);
485 Vc_ALL_SHIFTS(Vc_OP);
507#define Vc_CMP_OP(symbol) inline Vc_PURE MaskType operator symbol(const Vector &x) const;
508 Vc_ALL_COMPARES(Vc_CMP_OP);
708 template <
typename F>
inline void call(F &&f)
const;
745 inline VectorType &data();
746 inline const VectorType &data()
const;
772 static constexpr
size_t Size = VectorTraits<T, Abi>::
size();
790 template <typename V2>
791 Vc_DEPRECATED(
"use reinterpret_components_cast instead") inline V2
804 Vc_DEPRECATED(
"use copysign(x, y) instead") inline
Vector
808 Vc_FREE_STORE_OPERATORS_ALIGNED(alignof(
Vector));
832template <typename V, typename T, typename Abi>
833Vc_ALWAYS_INLINE Vc_CONST enable_if<
835 sizeof(typename V::VectorEntryType) ==
836 sizeof(typename
Vector<T, Abi>::VectorEntryType) &&
837 sizeof(V) == sizeof(
Vector<T, Abi>) && alignof(V) <= alignof(
Vector<T, Abi>)),
841 return reinterpret_cast<const V &
>(x);
844#define Vc_OP(symbol) \
845 template <typename T, typename Abi> \
846 inline Vector<T, Abi> &operator symbol##=(Vector<T, Abi> &, \
847 const Vector<T, Abi> &x);
The main SIMD mask class.
The main vector class for expressing data parallelism.
MaskType isNegative() const
Vc::fixed_size_simd< int, VectorTraits< T, Abi >::size()> IndexType
void setZeroInverted(MaskType mask)
static constexpr size_t size()
EntryType sum(MaskType mask) const
Vector copySign(Vector reference) const
V2 reinterpretCast() const
Vector apply(F &&f, MaskType mask) const
void fill(EntryType(&f)())
EntryType operator[](size_t index) const noexcept
void setQnan(MaskType mask)
void call(F &&f, MaskType mask) const
static Vector IndexesFromZero()
Vector(VectorSpecialInitializerZero)
Vector shifted(int amount) const
EntryType product() const
void callWithValuesSorted(F &&f)
void setZero(MaskType mask)
Vector apply(F &&f) const
static constexpr size_t Size
Vc::Mask< T, Abi > MaskType
void fill(EntryType(&f)(IndexT))
Vector(VectorSpecialInitializerIndexesFromZero)
static constexpr size_t MemoryAlignment
Vector rotated(int amount) const
static Vector generate(G gen)
Vector(Vector< U, abi > x, enable_if< Traits::is_implicit_cast_allowed< U, T >::value >=nullarg)
Common::WriteMaskedVector< Vector, MaskType > operator()(MaskType mask)
Vector(VectorSpecialInitializerOne)
Vector partialSum() const
reference operator[](size_t index) noexcept
EntryType min(MaskType mask) const
EntryType product(MaskType mask) const
typename VectorTraits< T, Abi >::EntryType EntryType
MaskType operator!() const
EntryType max(MaskType mask) const
Vector shifted(int amount, Vector shiftIn) const
fixed_size_simd< T, N > copysign(const SimdArray< T, N, V, M > &x, const SimdArray< T, N, V, M > &y)
Applies the std::copysign function component-wise and concurrently.
fixed_size_simd_mask< T, N > isnegative(const SimdArray< T, N, V, M > &x)
Applies the std::isnegative function component-wise and concurrently.
fixed_size_simd< T, N > exponent(const SimdArray< T, N, V, M > &x)
Applies the std::exponent function component-wise and concurrently.
enable_if<(V::size()==Vector< T, Abi >::size() &&sizeof(typename V::VectorEntryType)==sizeof(typename Vector< T, Abi >::VectorEntryType) &&sizeof(V)==sizeof(Vector< T, Abi >) &&alignof(V)<=alignof(Vector< T, Abi >)), V > reinterpret_components_cast(const Vector< T, Abi > &x)
Constructs a new Vector object of type V from the Vector x, reinterpreting the bits of x for the new ...