20 #ifndef SCALAR_VECTOR_H
21 #define SCALAR_VECTOR_H
31 #include "../common/memoryfwd.h"
53 typedef Vc::Memory<Vector<T>, 1>
Memory;
148 template<
typename IndexT>
Vc_ALWAYS_INLINE Vector(
const EntryType *array,
const IndexT *indexes) : m_data(array[indexes[0]]) {}
151 template<
typename S1,
typename IT>
Vc_ALWAYS_INLINE Vector(
const S1 *array,
const EntryType S1::* member1, IT indexes, Mask mask =
Mask(
true))
152 : m_data(mask.
data() ? (&array[indexes[0]])->*(member1) : 0) {}
154 const EntryType S2::* member2, IT indexes, Mask mask =
Mask(
true))
155 : m_data(mask.
data() ? array[indexes[0]].*(member1).*(member2) : 0) {}
156 template<
typename S1,
typename IT1,
typename IT2>
Vc_ALWAYS_INLINE Vector(
const S1 *array,
const EntryType *
const S1::* ptrMember1,
157 IT1 outerIndex, IT2 innerIndex, Mask mask =
Mask(
true))
158 : m_data(mask.
data() ? (array[outerIndex[0]].*(ptrMember1))[innerIndex[0]] : 0) {}
161 {
if (mask.data()) m_data = array[indexes[0]]; }
162 template<
typename S1,
typename IT>
Vc_ALWAYS_INLINE void gather(
const S1 *array,
const EntryType S1::* member1, IT indexes, Mask mask =
Mask(
true))
163 {
if (mask.data()) m_data = (&array[indexes[0]])->*(member1); }
165 const EntryType S2::* member2, IT indexes, Mask mask =
Mask(
true))
166 {
if (mask.data()) m_data = array[indexes[0]].*(member1).*(member2); }
167 template<
typename S1,
typename IT1,
typename IT2>
Vc_ALWAYS_INLINE void gather(
const S1 *array,
const EntryType *
const S1::* ptrMember1,
168 IT1 outerIndex, IT2 innerIndex, Mask mask =
Mask(
true))
169 {
if (mask.data()) m_data = (array[outerIndex[0]].*(ptrMember1))[innerIndex[0]]; }
175 if (
m.data()) array[indexes[0]].*(member) =
m_data;
179 if (
m.data()) array[indexes[0]].*(member1).*(member2) = m_data;
184 if (
m.data()) array[indexes[0]].*(member) =
m_data;
188 if (
m.data()) array[indexes[0]].*(member1).*(member2) = m_data;
199 assert(index == 0);
if(index) {}
204 assert(index == 0);
if(index) {}
212 #define OPshift(symbol) \
213 Vc_ALWAYS_INLINE Vector &operator symbol##=(const Vector<T> &x) { m_data symbol##= x.m_data; return *this; } \
214 Vc_ALWAYS_INLINE Vector &operator symbol##=(EntryType x) { return operator symbol##=(Vector(x)); } \
215 Vc_ALWAYS_INLINE Vector operator symbol(const Vector<T> &x) const { return Vector<T>(m_data symbol x.m_data); }
216 #define OPshift_int(symbol) \
217 Vc_ALWAYS_INLINE Vector operator symbol(int x) const { return Vector(m_data symbol x); }
220 template<typename TT> Vc_ALWAYS_INLINE VC_EXACT_TYPE(TT, EntryType, Vector) operator symbol(TT x) const { return operator symbol(Vector(x)); }
221 #define OPcmp(symbol) \
222 Vc_ALWAYS_INLINE Mask operator symbol(const Vector<T> &x) const { return Mask(m_data symbol x.m_data); } \
223 template<typename TT> Vc_ALWAYS_INLINE VC_EXACT_TYPE(TT, EntryType, Mask) operator symbol(TT x) const { return Mask(m_data symbol x); }
237 m_data = m_data * factor.data() + summand.data();
241 if (m.
data()) m_data = v.m_data;
247 return V2(*reinterpret_cast<const AliasT2 *>(&m_data));
352 __asm__ __volatile__(
""::
"r"(x01.data()));
355 __asm__ __volatile__(
""::
"x"(x01.data()));
358 __asm__ __volatile__(
""::
"x"(x01.data()));
371 template<
typename T1,
typename T2,
typename T3,
typename T4,
typename T5>
376 template<
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6>
381 template<
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
388 template<
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
389 typename T7,
typename T8>
395 template<
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
396 typename T7,
typename T8,
typename T9>
403 template<
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
404 typename T7,
typename T8,
typename T9,
typename T10>
411 template<
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
412 typename T7,
typename T8,
typename T9,
typename T10,
typename T11>
420 template<
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
421 typename T7,
typename T8,
typename T9,
typename T10,
typename T11,
typename T12>
429 template<
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
430 typename T7,
typename T8,
typename T9,
typename T10,
typename T11,
typename T12,
typename T13>
439 template<
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
440 typename T7,
typename T8,
typename T9,
typename T10,
typename T11,
typename T12,
typename T13,
449 template<
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
450 typename T7,
typename T8,
typename T9,
typename T10,
typename T11,
typename T12,
typename T13,
460 template<
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
461 typename T7,
typename T8,
typename T9,
typename T10,
typename T11,
typename T12,
typename T13,
476 #include "vector.tcc"
480 #endif // SCALAR_VECTOR_H
Vc_ALWAYS_INLINE void gather(const EntryType *array, IT indexes, Mask mask=Mask(true))
Vc_INTRINSIC const Vector< T > cccc() const
Vc_ALWAYS_INLINE EntryType operator[](size_t index) const
Vc_ALWAYS_INLINE Vector(TT x, VC_EXACT_TYPE(TT, EntryType, void *)=0)
Vc_INTRINSIC const Vector< T > dddd() const
Vector< unsigned int > IndexType
Vc_INTRINSIC const Vector< T > aaaa() const
Vc_ALWAYS_INLINE void store(EntryType *mem, Mask m, A) const
Small helper to encapsulate whether to return the value pointed to by the iterator or its address...
Vc_INTRINSIC Vector apply(const F &f) const
Namespace for new ROOT classes and functions.
Vc_ALWAYS_INLINE Vector(const S1 *array, const S2 S1::*member1, const EntryType S2::*member2, IT indexes, Mask mask=Mask(true))
static Vc_INTRINSIC_L Vector Random() Vc_INTRINSIC_R
#define VC_ALL_ARITHMETICS(macro)
Vc_ALWAYS_INLINE void scatter(S1 *array, EntryType S1::*member, const Vector< unsigned short > &indexes, Mask m=Mask(true)) const
Vc_INTRINSIC_L Vc_PURE_L Mask isNegative() const Vc_PURE_R Vc_INTRINSIC_R
Vc_ALWAYS_INLINE void assign(const Vector< T > &v, const Mask &m)
Vc_ALWAYS_INLINE void store(EntryType *mem, A) const
Vc_ALWAYS_INLINE Vector(const Vector< OtherT > *a)
#define OPshift_int(symbol)
Vc_ALWAYS_INLINE void expand(Vector< OtherT > *x) const
Vc_ALWAYS_INLINE Vector(const EntryType *array, const IndexT *indexes)
Vc_INTRINSIC_L void setQnan() Vc_INTRINSIC_R
Vc_ALWAYS_INLINE Vector & operator--()
Vc_INTRINSIC const Vector< T > dbca() const
#define VC_ALL_BINARY(macro)
Vc_INTRINSIC void call(F &f) const
Vc_ALWAYS_INLINE Vector(const EntryType *x, A)
Vc_ALWAYS_INLINE void scatter(EntryType *array, const Vector< unsigned int > &indexes, Mask m=Mask(true)) const
Vc_INTRINSIC const Vector< T > & abcd() const
Vc_ALWAYS_INLINE void store(EntryType *mem) const
Vc_ALWAYS_INLINE V2 staticCast() const
Vc_ALWAYS_INLINE Vector(EntryType x)
#define VC_EXACT_TYPE(_test, _reference, _type)
Vc_ALWAYS_INLINE Vector(const Other *x, A)
Vc_ALWAYS_INLINE bool pack(Mask &m1, Vector< T > &v2, Mask &m2)
Vc_ALWAYS_INLINE EntryType product(Mask) const
Vc_ALWAYS_INLINE void load(const Other *mem, Mask m)
Vc_ALWAYS_INLINE void fusedMultiplyAdd(const Vector< T > &factor, const Vector< T > &summand)
Vc::Memory< Vector< T >, 1 > Memory
Vc_ALWAYS_INLINE void setZero()
Vc_INTRINSIC_L Vector copySign(Vector reference) const Vc_INTRINSIC_R
Vc_ALWAYS_INLINE Vector(VectorSpecialInitializerOne::OEnum)
Vc_INTRINSIC void call(const F &f) const
Vc_INTRINSIC void fill(EntryType(&f)(IndexT))
Vc_INTRINSIC Vector apply(const F &f, Mask mask) const
Vc_ALWAYS_INLINE Vector(const Other *x)
#define Vc_ALWAYS_INLINE_R
Vc_ALWAYS_INLINE EntryType min(Mask) const
Vc_INTRINSIC void call(const F &f, Mask mask) const
Vc_ALWAYS_INLINE void setZero(Mask k)
Vc_ALWAYS_INLINE EntryType max() const
Vc_INTRINSIC Vector apply(F &f, Mask mask) const
Vc_ALWAYS_INLINE bool data() const
Vc_ALWAYS_INLINE Vector operator++(int)
Vc_INTRINSIC Vector apply(F &f) const
Vc_ALWAYS_INLINE Vector(const EntryType *array, Vector< IndexT > indexes)
Vc_ALWAYS_INLINE void gather(const S1 *array, const S2 S1::*member1, const EntryType S2::*member2, IT indexes, Mask mask=Mask(true))
Vc_ALWAYS_INLINE Vector operator--(int)
Vc_ALWAYS_INLINE EntryType sum(Mask m) const
Vc_ALWAYS_INLINE V2 reinterpretCast() const
Vc_ALWAYS_INLINE void gather(const S1 *array, const EntryType S1::*member1, IT indexes, Mask mask=Mask(true))
Vc_ALWAYS_INLINE Vector operator~() const
Vc_INTRINSIC Vector Vc_PURE operator+() const
Vc_ALWAYS_INLINE Vector & operator=(EntryType a)
#define VC_ALL_COMPARES(macro)
Vc_ALWAYS_INLINE EntryType max(Mask) const
Vc_ALWAYS_INLINE EntryType product() const
Vc_INTRINSIC const Vector< T > bbbb() const
Vc_INTRINSIC const Vector< T > dabc() const
Vc_ALWAYS_INLINE Vector()
Vc_ALWAYS_INLINE WriteMaskedVector< T > operator()(Mask m)
Vc_INTRINSIC_L Vector exponent() const Vc_INTRINSIC_R
Vc_ALWAYS_INLINE Vector(const S1 *array, const EntryType *const S1::*ptrMember1, IT1 outerIndex, IT2 innerIndex, Mask mask=Mask(true))
Vc_ALWAYS_INLINE void scatter(S1 *array, EntryType S1::*member, const Vector< unsigned int > &indexes, Mask m=Mask(true)) const
#define Vc_ALWAYS_INLINE_L
Vc_ALWAYS_INLINE void scatter(EntryType *array, const Vector< unsigned short > &indexes, Mask m=Mask(true)) const
Vc_ALWAYS_INLINE void load(const EntryType *mem)
Vc_ALWAYS_INLINE Vector(const S1 *array, const EntryType S1::*member1, IT indexes, Mask mask=Mask(true))
Vc_ALWAYS_INLINE Vector & operator++()
Vc_ALWAYS_INLINE void load(const EntryType *mem, Mask m)
Vc_ALWAYS_INLINE void scatter(S1 *array, S2 S1::*member1, EntryType S2::*member2, const Vector< unsigned int > &indexes, Mask m=Mask(true)) const
Vc_INTRINSIC void call(F &f, Mask mask) const
Vc_INTRINSIC const Vector< T > cdab() const
Vc_ALWAYS_INLINE void store(EntryType *mem, Mask m) const
#define VC_ALL_SHIFTS(macro)
Vc_ALWAYS_INLINE void gather(const S1 *array, const EntryType *const S1::*ptrMember1, IT1 outerIndex, IT2 innerIndex, Mask mask=Mask(true))
Vc_INTRINSIC void fill(EntryType(&f)())
static Vc_ALWAYS_INLINE Vector IndexesFromZero()
Vc_ALWAYS_INLINE Vector(VectorSpecialInitializerIndexesFromZero::IEnum)
Vc_ALWAYS_INLINE Vector & operator=(Vector v)
Vc_ALWAYS_INLINE Vector< typename NegateTypeHelper< T >::Type > operator-() const
Vc_INTRINSIC const Vector< T > badc() const
Vc_ALWAYS_INLINE void load(const EntryType *mem, A)
Vc_ALWAYS_INLINE EntryType sum() const
Vc_INTRINSIC const Vector< T > acbd() const
Vc_ALWAYS_INLINE Vector(const EntryType *x)
static Vc_ALWAYS_INLINE Vector Zero()
Vc_ALWAYS_INLINE void scatter(S1 *array, S2 S1::*member1, EntryType S2::*member2, const Vector< unsigned short > &indexes, Mask m=Mask(true)) const
void callWithValuesSorted(F &f)
Vc_INTRINSIC const Vector< T > bcda() const
Vc_ALWAYS_INLINE Vector(const EntryType *array, IndexT indexes, Mask m)
Vc_ALWAYS_INLINE Vector(VectorSpecialInitializerZero::ZEnum)
Vc_ALWAYS_INLINE_L Vector & operator=(const Vector< OtherT > &x) Vc_ALWAYS_INLINE_R
Vc_ALWAYS_INLINE void load(const Other *mem)
static Vc_ALWAYS_INLINE Vector One()
Vc_INTRINSIC Vector rotated(int) const
Vc_ALWAYS_INLINE EntryType data() const
Vc_INTRINSIC const Vector< T > dcba() const
DetermineEntryType< T >::Type EntryType
Vc_ALWAYS_INLINE void load(const Other *mem, A)
Vc_ALWAYS_INLINE EntryType min() const
Vc_INTRINSIC Vector shifted(int amount) const
static Vc_ALWAYS_INLINE void forceToRegisters(const Vector< T > &x01)
Vc_ALWAYS_INLINE EntryType & operator[](size_t index)
Vc_ALWAYS_INLINE EntryType & data()
Vc_INTRINSIC const Vector< T > bcad() const