ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
vector.h
Go to the documentation of this file.
1 /* This file is part of the Vc library.
2 
3  Copyright (C) 2009-2012 Matthias Kretz <kretz@kde.org>
4 
5  Vc is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as
7  published by the Free Software Foundation, either version 3 of
8  the License, or (at your option) any later version.
9 
10  Vc is distributed in the hope that it will be useful, but
11  WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with Vc. If not, see <http://www.gnu.org/licenses/>.
17 
18 */
19 
20 #ifndef AVX_VECTOR_H
21 #define AVX_VECTOR_H
22 
23 #include "intrinsics.h"
24 #include "vectorhelper.h"
25 #include "mask.h"
26 #include "writemaskedvector.h"
27 #include "sorthelper.h"
28 #include <algorithm>
29 #include <cmath>
30 #include "../common/aliasingentryhelper.h"
31 #include "../common/memoryfwd.h"
32 #include "macros.h"
33 
34 #ifdef isfinite
35 #undef isfinite
36 #endif
37 #ifdef isnan
38 #undef isnan
39 #endif
40 
41 namespace ROOT {
42 namespace Vc
43 {
44 namespace AVX
45 {
47 
48 template<typename T> class Vector
49 {
50  public:
52 
53  typedef typename VectorTypeHelper<T>::Type VectorType;
54  typedef typename DetermineEntryType<T>::Type EntryType;
55  enum Constants {
56  Size = sizeof(VectorType) / sizeof(EntryType),
58  };
61  typedef typename Mask::AsArg MaskArg;
63 #ifdef VC_PASSING_VECTOR_BY_VALUE_IS_BROKEN
64  typedef const Vector<T> &AsArg;
65  typedef const VectorType &VectorTypeArg;
66 #else
67  typedef Vector<T> AsArg;
68  typedef VectorType VectorTypeArg;
69 #endif
70 
71  protected:
72  // helper that specializes on VectorType
74 
75  // helper that specializes on T
77 
78  // cast any m256/m128 to VectorType
79  static Vc_INTRINSIC VectorType _cast(param128 v) { return avx_cast<VectorType>(v); }
80  static Vc_INTRINSIC VectorType _cast(param128i v) { return avx_cast<VectorType>(v); }
81  static Vc_INTRINSIC VectorType _cast(param128d v) { return avx_cast<VectorType>(v); }
82  static Vc_INTRINSIC VectorType _cast(param256 v) { return avx_cast<VectorType>(v); }
83  static Vc_INTRINSIC VectorType _cast(param256i v) { return avx_cast<VectorType>(v); }
84  static Vc_INTRINSIC VectorType _cast(param256d v) { return avx_cast<VectorType>(v); }
85 
86 #ifdef VC_UNCONDITIONAL_AVX2_INTRINSICS
88 #else
90 #endif
92 
93  public:
94  ///////////////////////////////////////////////////////////////////////////////////////////
95  // uninitialized
97 
98  ///////////////////////////////////////////////////////////////////////////////////////////
99  // constants
101  explicit Vc_ALWAYS_INLINE_L Vector(VectorSpecialInitializerOne::OEnum) Vc_ALWAYS_INLINE_R;
102  explicit Vc_ALWAYS_INLINE_L Vector(VectorSpecialInitializerIndexesFromZero::IEnum) Vc_ALWAYS_INLINE_R;
103  static Vc_INTRINSIC_L Vc_CONST_L Vector Zero() Vc_INTRINSIC_R Vc_CONST_R;
104  static Vc_INTRINSIC_L Vc_CONST_L Vector One() Vc_INTRINSIC_R Vc_CONST_R;
105  static Vc_INTRINSIC_L Vc_CONST_L Vector IndexesFromZero() Vc_INTRINSIC_R Vc_CONST_R;
106  static Vc_ALWAYS_INLINE_L Vector Random() Vc_ALWAYS_INLINE_R;
107 
108  ///////////////////////////////////////////////////////////////////////////////////////////
109  // internal: required to enable returning objects of VectorType
111 #ifdef VC_UNCONDITIONAL_AVX2_INTRINSICS
112  Vc_ALWAYS_INLINE Vector(typename VectorType::Base x) : d(x) {}
113 #endif
114 
115  ///////////////////////////////////////////////////////////////////////////////////////////
116  // static_cast / copy ctor
117  template<typename T2> explicit Vector(VC_ALIGNED_PARAMETER(Vector<T2>) x);
118 
119  // implicit cast
120  template<typename OtherT> Vc_INTRINSIC_L Vector &operator=(const Vector<OtherT> &x) Vc_INTRINSIC_R;
121 
122  // copy assignment
123  Vc_ALWAYS_INLINE Vector &operator=(AsArg v) { d.v() = v.d.v(); return *this; }
124 
125  ///////////////////////////////////////////////////////////////////////////////////////////
126  // broadcast
127  explicit Vc_ALWAYS_INLINE_L Vector(EntryType a) Vc_ALWAYS_INLINE_R;
128  template<typename TT> Vc_INTRINSIC Vector(TT x, VC_EXACT_TYPE(TT, EntryType, void *) = 0) : d(HT::set(x)) {}
129  Vc_ALWAYS_INLINE Vector &operator=(EntryType a) { d.v() = HT::set(a); return *this; }
130 
131  ///////////////////////////////////////////////////////////////////////////////////////////
132  // load ctors
133  explicit Vc_INTRINSIC_L
134  Vector(const EntryType *x) Vc_INTRINSIC_R;
135  template<typename Alignment> Vc_INTRINSIC_L
136  Vector(const EntryType *x, Alignment align) Vc_INTRINSIC_R;
137  template<typename OtherT> explicit Vc_INTRINSIC_L
138  Vector(const OtherT *x) Vc_INTRINSIC_R;
139  template<typename OtherT, typename Alignment> Vc_INTRINSIC_L
140  Vector(const OtherT *x, Alignment align) Vc_INTRINSIC_R;
141 
142  ///////////////////////////////////////////////////////////////////////////////////////////
143  // load member functions
145  void load(const EntryType *mem) Vc_INTRINSIC_R;
146  template<typename Alignment> Vc_INTRINSIC_L
147  void load(const EntryType *mem, Alignment align) Vc_INTRINSIC_R;
148  template<typename OtherT> Vc_INTRINSIC_L
149  void load(const OtherT *mem) Vc_INTRINSIC_R;
150  template<typename OtherT, typename Alignment> Vc_INTRINSIC_L
151  void load(const OtherT *mem, Alignment align) Vc_INTRINSIC_R;
152 
153  ///////////////////////////////////////////////////////////////////////////////////////////
154  // expand/merge 1 float_v <=> 2 double_v XXX rationale? remove it for release? XXX
155  explicit inline Vector(const Vector<typename HT::ConcatType> *a);
156  inline void expand(Vector<typename HT::ConcatType> *x) const;
157 
158  ///////////////////////////////////////////////////////////////////////////////////////////
159  // zeroing
160  Vc_INTRINSIC_L void setZero() Vc_INTRINSIC_R;
161  Vc_INTRINSIC_L void setZero(const Mask &k) Vc_INTRINSIC_R;
162 
163  Vc_INTRINSIC_L void setQnan() Vc_INTRINSIC_R;
164  Vc_INTRINSIC_L void setQnan(MaskArg k) Vc_INTRINSIC_R;
165 
166  ///////////////////////////////////////////////////////////////////////////////////////////
167  // stores
168  Vc_INTRINSIC_L void store(EntryType *mem) const Vc_INTRINSIC_R;
169  Vc_INTRINSIC_L void store(EntryType *mem, const Mask &mask) const Vc_INTRINSIC_R;
170  template<typename A> Vc_INTRINSIC_L void store(EntryType *mem, A align) const Vc_INTRINSIC_R;
171  template<typename A> Vc_INTRINSIC_L void store(EntryType *mem, const Mask &mask, A align) const Vc_INTRINSIC_R;
172 
173  ///////////////////////////////////////////////////////////////////////////////////////////
174  // swizzles
175  Vc_INTRINSIC_L Vc_PURE_L const Vector<T> &abcd() const Vc_INTRINSIC_R Vc_PURE_R;
176  Vc_INTRINSIC_L Vc_PURE_L const Vector<T> cdab() const Vc_INTRINSIC_R Vc_PURE_R;
177  Vc_INTRINSIC_L Vc_PURE_L const Vector<T> badc() const Vc_INTRINSIC_R Vc_PURE_R;
178  Vc_INTRINSIC_L Vc_PURE_L const Vector<T> aaaa() const Vc_INTRINSIC_R Vc_PURE_R;
179  Vc_INTRINSIC_L Vc_PURE_L const Vector<T> bbbb() const Vc_INTRINSIC_R Vc_PURE_R;
180  Vc_INTRINSIC_L Vc_PURE_L const Vector<T> cccc() const Vc_INTRINSIC_R Vc_PURE_R;
181  Vc_INTRINSIC_L Vc_PURE_L const Vector<T> dddd() const Vc_INTRINSIC_R Vc_PURE_R;
182  Vc_INTRINSIC_L Vc_PURE_L const Vector<T> bcad() const Vc_INTRINSIC_R Vc_PURE_R;
183  Vc_INTRINSIC_L Vc_PURE_L const Vector<T> bcda() const Vc_INTRINSIC_R Vc_PURE_R;
184  Vc_INTRINSIC_L Vc_PURE_L const Vector<T> dabc() const Vc_INTRINSIC_R Vc_PURE_R;
185  Vc_INTRINSIC_L Vc_PURE_L const Vector<T> acbd() const Vc_INTRINSIC_R Vc_PURE_R;
186  Vc_INTRINSIC_L Vc_PURE_L const Vector<T> dbca() const Vc_INTRINSIC_R Vc_PURE_R;
187  Vc_INTRINSIC_L Vc_PURE_L const Vector<T> dcba() const Vc_INTRINSIC_R Vc_PURE_R;
188 
189  ///////////////////////////////////////////////////////////////////////////////////////////
190  // gathers
191  template<typename IndexT> Vector(const EntryType *mem, const IndexT *indexes);
192  template<typename IndexT> Vector(const EntryType *mem, VC_ALIGNED_PARAMETER(Vector<IndexT>) indexes);
193  template<typename IndexT> Vector(const EntryType *mem, const IndexT *indexes, MaskArg mask);
194  template<typename IndexT> Vector(const EntryType *mem, VC_ALIGNED_PARAMETER(Vector<IndexT>) indexes, MaskArg mask);
195  template<typename S1, typename IT> Vector(const S1 *array, const EntryType S1::* member1, VC_ALIGNED_PARAMETER(IT) indexes);
196  template<typename S1, typename IT> Vector(const S1 *array, const EntryType S1::* member1, VC_ALIGNED_PARAMETER(IT) indexes, MaskArg mask);
197  template<typename S1, typename S2, typename IT> Vector(const S1 *array, const S2 S1::* member1, const EntryType S2::* member2, VC_ALIGNED_PARAMETER(IT) indexes);
198  template<typename S1, typename S2, typename IT> Vector(const S1 *array, const S2 S1::* member1, const EntryType S2::* member2, VC_ALIGNED_PARAMETER(IT) indexes, MaskArg mask);
199  template<typename S1, typename IT1, typename IT2> Vector(const S1 *array, const EntryType *const S1::* ptrMember1, VC_ALIGNED_PARAMETER(IT1) outerIndexes, VC_ALIGNED_PARAMETER(IT2) innerIndexes);
200  template<typename S1, typename IT1, typename IT2> Vector(const S1 *array, const EntryType *const S1::* ptrMember1, VC_ALIGNED_PARAMETER(IT1) outerIndexes, VC_ALIGNED_PARAMETER(IT2) innerIndexes, MaskArg mask);
201  template<typename Index> void gather(const EntryType *mem, VC_ALIGNED_PARAMETER(Index) indexes);
202  template<typename Index> void gather(const EntryType *mem, VC_ALIGNED_PARAMETER(Index) indexes, MaskArg mask);
203 #ifdef VC_USE_SET_GATHERS
204  template<typename IT> void gather(const EntryType *mem, VC_ALIGNED_PARAMETER(Vector<IT>) indexes, MaskArg mask);
205 #endif
206  template<typename S1, typename IT> void gather(const S1 *array, const EntryType S1::* member1, VC_ALIGNED_PARAMETER(IT) indexes);
207  template<typename S1, typename IT> void gather(const S1 *array, const EntryType S1::* member1, VC_ALIGNED_PARAMETER(IT) indexes, MaskArg mask);
208  template<typename S1, typename S2, typename IT> void gather(const S1 *array, const S2 S1::* member1, const EntryType S2::* member2, VC_ALIGNED_PARAMETER(IT) indexes);
209  template<typename S1, typename S2, typename IT> void gather(const S1 *array, const S2 S1::* member1, const EntryType S2::* member2, VC_ALIGNED_PARAMETER(IT) indexes, MaskArg mask);
210  template<typename S1, typename IT1, typename IT2> void gather(const S1 *array, const EntryType *const S1::* ptrMember1, VC_ALIGNED_PARAMETER(IT1) outerIndexes, VC_ALIGNED_PARAMETER(IT2) innerIndexes);
211  template<typename S1, typename IT1, typename IT2> void gather(const S1 *array, const EntryType *const S1::* ptrMember1, VC_ALIGNED_PARAMETER(IT1) outerIndexes, VC_ALIGNED_PARAMETER(IT2) innerIndexes, MaskArg mask);
212 
213  ///////////////////////////////////////////////////////////////////////////////////////////
214  // scatters
215  template<typename Index> void scatter(EntryType *mem, VC_ALIGNED_PARAMETER(Index) indexes) const;
216  template<typename Index> void scatter(EntryType *mem, VC_ALIGNED_PARAMETER(Index) indexes, MaskArg mask) const;
217  template<typename S1, typename IT> void scatter(S1 *array, EntryType S1::* member1, VC_ALIGNED_PARAMETER(IT) indexes) const;
218  template<typename S1, typename IT> void scatter(S1 *array, EntryType S1::* member1, VC_ALIGNED_PARAMETER(IT) indexes, MaskArg mask) const;
219  template<typename S1, typename S2, typename IT> void scatter(S1 *array, S2 S1::* member1, EntryType S2::* member2, VC_ALIGNED_PARAMETER(IT) indexes) const;
220  template<typename S1, typename S2, typename IT> void scatter(S1 *array, S2 S1::* member1, EntryType S2::* member2, VC_ALIGNED_PARAMETER(IT) indexes, MaskArg mask) const;
221  template<typename S1, typename IT1, typename IT2> void scatter(S1 *array, EntryType *S1::* ptrMember1, VC_ALIGNED_PARAMETER(IT1) outerIndexes, VC_ALIGNED_PARAMETER(IT2) innerIndexes) const;
222  template<typename S1, typename IT1, typename IT2> void scatter(S1 *array, EntryType *S1::* ptrMember1, VC_ALIGNED_PARAMETER(IT1) outerIndexes, VC_ALIGNED_PARAMETER(IT2) innerIndexes, MaskArg mask) const;
223 
224  ///////////////////////////////////////////////////////////////////////////////////////////
225  //prefix
228  //postfix
231 
233 #if defined(VC_GCC) && VC_GCC >= 0x40300 && VC_GCC < 0x40400
235 #endif
236  return d.m(index);
237  }
238  Vc_ALWAYS_INLINE EntryType operator[](size_t index) const {
239  return d.m(index);
240  }
241 
244  Vc_INTRINSIC Vc_PURE Vector operator+() const { return *this; }
245 
246 #define OP1(fun) \
247  Vc_ALWAYS_INLINE Vector fun() const { return Vector<T>(VectorHelper<T>::fun(data())); } \
248  Vc_ALWAYS_INLINE Vector &fun##_eq() { data() = VectorHelper<T>::fun(data()); return *this; }
249  OP1(sqrt)
250  OP1(abs)
251 #undef OP1
252 
253 #define OP(symbol, fun) \
254  Vc_ALWAYS_INLINE Vector &operator symbol##=(const Vector<T> &x) { data() = VectorHelper<T>::fun(data(), x.data()); return *this; } \
255  Vc_ALWAYS_INLINE Vector &operator symbol##=(EntryType x) { return operator symbol##=(Vector(x)); } \
256  Vc_ALWAYS_INLINE Vector operator symbol(const Vector<T> &x) const { return Vector<T>(VectorHelper<T>::fun(data(), x.data())); } \
257  template<typename TT> Vc_ALWAYS_INLINE VC_EXACT_TYPE(TT, EntryType, Vector) operator symbol(TT x) const { return operator symbol(Vector(x)); }
258 
259  OP(+, add)
260  OP(-, sub)
261  OP(*, mul)
262 #undef OP
263  inline Vector &operator/=(EntryType x);
264  template<typename TT> inline Vc_PURE_L VC_EXACT_TYPE(TT, EntryType, Vector) operator/(TT x) const Vc_PURE_R;
265  inline Vector &operator/=(const Vector<T> &x);
266  inline Vc_PURE_L Vector operator/ (const Vector<T> &x) const Vc_PURE_R;
267 
268  // bitwise ops
269 #define OP_VEC(op) \
270  Vc_ALWAYS_INLINE_L Vector<T> &operator op##=(AsArg x) Vc_ALWAYS_INLINE_R; \
271  Vc_ALWAYS_INLINE_L Vc_PURE_L Vector<T> operator op (AsArg x) const Vc_ALWAYS_INLINE_R Vc_PURE_R;
272 #define OP_ENTRY(op) \
273  Vc_ALWAYS_INLINE Vector<T> &operator op##=(EntryType x) { return operator op##=(Vector(x)); } \
274  template<typename TT> Vc_ALWAYS_INLINE Vc_PURE VC_EXACT_TYPE(TT, EntryType, Vector) operator op(TT x) const { return operator op(Vector(x)); }
278 #undef OP_VEC
279 #undef OP_ENTRY
280 
283  Vc_ALWAYS_INLINE_L Vector<T> operator>>(int x) const Vc_ALWAYS_INLINE_R;
284  Vc_ALWAYS_INLINE_L Vector<T> operator<<(int x) const Vc_ALWAYS_INLINE_R;
285 
286 #define OPcmp(symbol, fun) \
287  Vc_ALWAYS_INLINE Mask operator symbol(AsArg x) const { return VectorHelper<T>::fun(data(), x.data()); } \
288  template<typename TT> Vc_ALWAYS_INLINE VC_EXACT_TYPE(TT, EntryType, Mask) operator symbol(TT x) const { return operator symbol(Vector(x)); }
289 
290  OPcmp(==, cmpeq)
291  OPcmp(!=, cmpneq)
292  OPcmp(>=, cmpnlt)
293  OPcmp(>, cmpnle)
294  OPcmp(<, cmplt)
295  OPcmp(<=, cmple)
296 #undef OPcmp
297  Vc_INTRINSIC_L Vc_PURE_L Mask isNegative() const Vc_PURE_R Vc_INTRINSIC_R;
298 
299  Vc_ALWAYS_INLINE void fusedMultiplyAdd(const Vector<T> &factor, const Vector<T> &summand) {
300  VectorHelper<T>::fma(data(), factor.data(), summand.data());
301  }
302 
303  Vc_ALWAYS_INLINE void assign( const Vector<T> &v, const Mask &mask ) {
304  const VectorType k = avx_cast<VectorType>(mask.data());
305  data() = VectorHelper<VectorType>::blend(data(), v.data(), k);
306  }
307 
308  template<typename V2> Vc_ALWAYS_INLINE V2 staticCast() const { return V2(*this); }
309  template<typename V2> Vc_ALWAYS_INLINE V2 reinterpretCast() const { return avx_cast<typename V2::VectorType>(data()); }
310 
312 
313  /**
314  * \return \p true This vector was completely filled. m2 might be 0 or != 0. You still have
315  * to test this.
316  * \p false This vector was not completely filled. m2 is all 0.
317  */
318  //inline bool pack(Mask &m1, Vector<T> &v2, Mask &m2) {
319  //return VectorHelper<T>::pack(data(), m1.data, v2.data(), m2.data);
320  //}
321 
322  Vc_ALWAYS_INLINE VectorType &data() { return d.v(); }
323  Vc_ALWAYS_INLINE const VectorType data() const { return d.v(); }
324 
325  Vc_ALWAYS_INLINE EntryType min() const { return VectorHelper<T>::min(data()); }
326  Vc_ALWAYS_INLINE EntryType max() const { return VectorHelper<T>::max(data()); }
327  Vc_ALWAYS_INLINE EntryType product() const { return VectorHelper<T>::mul(data()); }
328  Vc_ALWAYS_INLINE EntryType sum() const { return VectorHelper<T>::add(data()); }
333 
334  Vc_INTRINSIC_L Vector shifted(int amount) const Vc_INTRINSIC_R;
335  Vc_INTRINSIC_L Vector rotated(int amount) const Vc_INTRINSIC_R;
337 
338  template<typename F> void callWithValuesSorted(F &f) {
339  EntryType value = d.m(0);
340  f(value);
341  for (int i = 1; i < Size; ++i) {
342  if (d.m(i) != value) {
343  value = d.m(i);
344  f(value);
345  }
346  }
347  }
348 
349  template<typename F> Vc_INTRINSIC void call(const F &f) const {
351  f(EntryType(d.m(i)));
352  );
353  }
354  template<typename F> Vc_INTRINSIC void call(F &f) const {
356  f(EntryType(d.m(i)));
357  );
358  }
359 
360  template<typename F> Vc_INTRINSIC void call(const F &f, const Mask &mask) const {
361  Vc_foreach_bit(size_t i, mask) {
362  f(EntryType(d.m(i)));
363  }
364  }
365  template<typename F> Vc_INTRINSIC void call(F &f, const Mask &mask) const {
366  Vc_foreach_bit(size_t i, mask) {
367  f(EntryType(d.m(i)));
368  }
369  }
370 
371  template<typename F> Vc_INTRINSIC Vector<T> apply(const F &f) const {
372  Vector<T> r;
374  r.d.m(i) = f(EntryType(d.m(i)));
375  );
376  return r;
377  }
378  template<typename F> Vc_INTRINSIC Vector<T> apply(F &f) const {
379  Vector<T> r;
381  r.d.m(i) = f(EntryType(d.m(i)));
382  );
383  return r;
384  }
385 
386  template<typename F> Vc_INTRINSIC Vector<T> apply(const F &f, const Mask &mask) const {
387  Vector<T> r(*this);
388  Vc_foreach_bit (size_t i, mask) {
389  r.d.m(i) = f(EntryType(r.d.m(i)));
390  }
391  return r;
392  }
393  template<typename F> Vc_INTRINSIC Vector<T> apply(F &f, const Mask &mask) const {
394  Vector<T> r(*this);
395  Vc_foreach_bit (size_t i, mask) {
396  r.d.m(i) = f(EntryType(r.d.m(i)));
397  }
398  return r;
399  }
400 
401  template<typename IndexT> Vc_INTRINSIC void fill(EntryType (&f)(IndexT)) {
403  d.m(i) = f(i);
404  );
405  }
406  Vc_INTRINSIC void fill(EntryType (&f)()) {
408  d.m(i) = f();
409  );
410  }
411 
413  Vc_INTRINSIC_L Vector exponent() const Vc_INTRINSIC_R;
414 };
415 
416 typedef Vector<double> double_v;
417 typedef Vector<float> float_v;
419 typedef Vector<int> int_v;
420 typedef Vector<unsigned int> uint_v;
421 typedef Vector<short> short_v;
422 typedef Vector<unsigned short> ushort_v;
423 typedef double_v::Mask double_m;
424 typedef float_v::Mask float_m;
425 typedef sfloat_v::Mask sfloat_m;
426 typedef int_v::Mask int_m;
427 typedef uint_v::Mask uint_m;
428 typedef short_v::Mask short_m;
429 typedef ushort_v::Mask ushort_m;
430 
431 template<typename T> class SwizzledVector : public Vector<T> {};
432 
433 static Vc_ALWAYS_INLINE int_v min(const int_v &x, const int_v &y) { return _mm256_min_epi32(x.data(), y.data()); }
434 static Vc_ALWAYS_INLINE uint_v min(const uint_v &x, const uint_v &y) { return _mm256_min_epu32(x.data(), y.data()); }
435 static Vc_ALWAYS_INLINE short_v min(const short_v &x, const short_v &y) { return _mm_min_epi16(x.data(), y.data()); }
436 static Vc_ALWAYS_INLINE ushort_v min(const ushort_v &x, const ushort_v &y) { return _mm_min_epu16(x.data(), y.data()); }
437 static Vc_ALWAYS_INLINE float_v min(const float_v &x, const float_v &y) { return _mm256_min_ps(x.data(), y.data()); }
438 static Vc_ALWAYS_INLINE sfloat_v min(const sfloat_v &x, const sfloat_v &y) { return _mm256_min_ps(x.data(), y.data()); }
439 static Vc_ALWAYS_INLINE double_v min(const double_v &x, const double_v &y) { return _mm256_min_pd(x.data(), y.data()); }
440 static Vc_ALWAYS_INLINE int_v max(const int_v &x, const int_v &y) { return _mm256_max_epi32(x.data(), y.data()); }
441 static Vc_ALWAYS_INLINE uint_v max(const uint_v &x, const uint_v &y) { return _mm256_max_epu32(x.data(), y.data()); }
442 static Vc_ALWAYS_INLINE short_v max(const short_v &x, const short_v &y) { return _mm_max_epi16(x.data(), y.data()); }
443 static Vc_ALWAYS_INLINE ushort_v max(const ushort_v &x, const ushort_v &y) { return _mm_max_epu16(x.data(), y.data()); }
444 static Vc_ALWAYS_INLINE float_v max(const float_v &x, const float_v &y) { return _mm256_max_ps(x.data(), y.data()); }
445 static Vc_ALWAYS_INLINE sfloat_v max(const sfloat_v &x, const sfloat_v &y) { return _mm256_max_ps(x.data(), y.data()); }
446 static Vc_ALWAYS_INLINE double_v max(const double_v &x, const double_v &y) { return _mm256_max_pd(x.data(), y.data()); }
447 
448  template<typename T> static Vc_ALWAYS_INLINE Vector<T> sqrt (const Vector<T> &x) { return VectorHelper<T>::sqrt(x.data()); }
449  template<typename T> static Vc_ALWAYS_INLINE Vector<T> rsqrt(const Vector<T> &x) { return VectorHelper<T>::rsqrt(x.data()); }
450  template<typename T> static Vc_ALWAYS_INLINE Vector<T> abs (const Vector<T> &x) { return VectorHelper<T>::abs(x.data()); }
451  template<typename T> static Vc_ALWAYS_INLINE Vector<T> reciprocal(const Vector<T> &x) { return VectorHelper<T>::reciprocal(x.data()); }
452  template<typename T> static Vc_ALWAYS_INLINE Vector<T> round(const Vector<T> &x) { return VectorHelper<T>::round(x.data()); }
453 
454  template<typename T> static Vc_ALWAYS_INLINE typename Vector<T>::Mask isfinite(const Vector<T> &x) { return VectorHelper<T>::isFinite(x.data()); }
455  template<typename T> static Vc_ALWAYS_INLINE typename Vector<T>::Mask isnan(const Vector<T> &x) { return VectorHelper<T>::isNaN(x.data()); }
456 
457 #include "forceToRegisters.tcc"
458 } // namespace AVX
459 } // namespace Vc
460 } // namespace ROOT
461 
462 #include "vector.tcc"
463 #include "math.h"
464 #include "undomacros.h"
465 
466 #endif // AVX_VECTOR_H
#define OP1(fun)
Definition: vector.h:246
static VectorType sort(VTArg)
VectorHelper< T > HT
Definition: vector.h:76
Common::VectorMemoryUnion< VectorType, EntryType > StorageType
Definition: vector.h:89
Vc_ALWAYS_INLINE EntryType sum() const
Definition: vector.h:328
const m256d param256d
Definition: intrinsics.h:129
void gather(const EntryType *mem, VC_ALIGNED_PARAMETER(Index) indexes)
Vc_ALWAYS_INLINE_L Vector< T > operator>>(int x) const Vc_ALWAYS_INLINE_R
Vc_INTRINSIC_L Vc_PURE_L const Vector< T > aaaa() const Vc_INTRINSIC_R Vc_PURE_R
VECTOR_NAMESPACE::sfloat_v sfloat_v
Definition: vector.h:82
Vc_INTRINSIC Vector(TT x, VC_EXACT_TYPE(TT, EntryType, void *)=0)
Definition: vector.h:128
Vc_INTRINSIC Vector< T > apply(F &f, const Mask &mask) const
Definition: vector.h:393
#define Vc_foreach_bit(_it_, _mask_)
Definition: mask.h:202
static Vc_INTRINSIC VectorType _cast(param256i v)
Definition: vector.h:83
Vc_INTRINSIC_L Vc_PURE_L const Vector< T > bbbb() const Vc_INTRINSIC_R Vc_PURE_R
Small helper to encapsulate whether to return the value pointed to by the iterator or its address...
#define Vc_CONST_L
Definition: macros.h:134
Vc_INTRINSIC_L Vc_PURE_L const Vector< T > cdab() const Vc_INTRINSIC_R Vc_PURE_R
Vc_INTRINSIC_L Vector & operator=(const Vector< OtherT > &x) Vc_INTRINSIC_R
cmpneq cmpnle cmple Vc_INTRINSIC_L Vc_PURE_L Mask isNegative() const Vc_PURE_R Vc_INTRINSIC_R
static Vc_INTRINSIC_L T avx_cast(param128 v) Vc_INTRINSIC_R
Definition: casts.h:49
#define OP(symbol, fun)
Definition: vector.h:253
Vc_INTRINSIC_L Vc_PURE_L const Vector< T > bcad() const Vc_INTRINSIC_R Vc_PURE_R
Vc_INTRINSIC_L Vc_PURE_L const Vector< T > bcda() const Vc_INTRINSIC_R Vc_PURE_R
const m128 param128
Definition: intrinsics.h:125
Vc_INTRINSIC_L Vector shifted(int amount) const Vc_INTRINSIC_R
#define FREE_STORE_OPERATORS_ALIGNED(alignment)
Definition: macros.h:165
Vc::Memory< Vector< T >, Size > Memory
Definition: vector.h:62
#define VC_ALL_BINARY(macro)
Definition: macros.h:356
Vc_INTRINSIC_L Vector rotated(int amount) const Vc_INTRINSIC_R
void expand(Vector< typename HT::ConcatType > *x) const
static Vc_ALWAYS_INLINE Vector< T > reciprocal(const Vector< T > &x)
Definition: vector.h:451
static Vc_INTRINSIC VectorType _cast(param128 v)
Definition: vector.h:79
VectorHelper< VectorType > HV
Definition: vector.h:73
Vc_ALWAYS_INLINE V2 reinterpretCast() const
Definition: vector.h:309
Vc_INTRINSIC void call(const F &f, const Mask &mask) const
Definition: vector.h:360
#define Vc_PURE_L
Definition: macros.h:137
TArc * a
Definition: textangle.C:12
Vc_INTRINSIC void call(F &f) const
Definition: vector.h:354
#define Vc_INTRINSIC
Definition: macros.h:139
Vc_ALWAYS_INLINE Vc_PURE AliasingEntryType & m(size_t index)
Definition: storage.h:86
Vc_ALWAYS_INLINE const VectorType data() const
Definition: vector.h:323
static double A[]
static Vc_ALWAYS_INLINE Vector< T >::Mask isfinite(const Vector< T > &x)
Definition: vector.h:454
TFile * f
Vc_ALWAYS_INLINE_L Vector< T > operator<<(int x) const Vc_ALWAYS_INLINE_R
VectorAlignmentEnum
Definition: vector.h:46
Vc_INTRINSIC_L void setZero() Vc_INTRINSIC_R
Vc_ALWAYS_INLINE Vector sorted() const
Definition: vector.h:336
Vc_ALWAYS_INLINE void fusedMultiplyAdd(const Vector< T > &factor, const Vector< T > &summand)
Definition: vector.h:299
TTree * T
VectorTypeHelper< T >::Type VectorType
Definition: vector.h:53
void _operator_bracket_warning()
Definition: const.cpp:512
double sqrt(double)
Vc_ALWAYS_INLINE EntryType operator[](size_t index) const
Definition: vector.h:238
static Vc_ALWAYS_INLINE Vc_PURE Vector< T > abs(const Vector< T > &x)
Definition: vector.h:524
#define for_all_vector_entries(_it_, _code_)
Definition: macros.h:202
Vc_INTRINSIC void fill(EntryType(&f)())
Definition: vector.h:406
Vc_PURE_L VC_EXACT_TYPE(TT, EntryType, Vector) operator/(TT x) const Vc_PURE_R
Vc_ALWAYS_INLINE Vector operator~() const
Definition: vector.h:242
const m256i param256i
Definition: intrinsics.h:130
static Vc_INTRINSIC VectorType _cast(param128i v)
Definition: vector.h:80
Vc_INTRINSIC Vector< T > apply(const F &f, const Mask &mask) const
Definition: vector.h:386
static Vc_ALWAYS_INLINE Vector< T > abs(const Vector< T > &x)
Definition: vector.h:450
void align()
Definition: geodemo.C:1778
Vc_INTRINSIC_L Vc_PURE_L const Vector< T > dbca() const Vc_INTRINSIC_R Vc_PURE_R
Vc_INTRINSIC Common::AliasingEntryHelper< StorageType > operator[](size_t index)
Definition: vector.h:232
Vc_INTRINSIC_L void setQnan() Vc_INTRINSIC_R
#define OP_VEC(op)
Definition: vector.h:269
Vc_ALWAYS_INLINE_L Vector< T > & operator>>=(int x) Vc_ALWAYS_INLINE_R
static Vc_ALWAYS_INLINE Vc_PURE Vector< T > round(const Vector< T > &x)
Definition: vector.h:526
static Vc_INTRINSIC_L Vc_CONST_L Vector Zero() Vc_INTRINSIC_R Vc_CONST_R
VectorType VectorTypeArg
Definition: vector.h:68
static Vc_INTRINSIC_L Vc_CONST_L Vector One() Vc_INTRINSIC_R Vc_CONST_R
static Vc_ALWAYS_INLINE Vector< T > sqrt(const Vector< T > &x)
Definition: vector.h:448
#define Vc_PURE
Definition: macros.h:136
#define AVX
Definition: global.h:90
Vc_INTRINSIC Vector< T > apply(const F &f) const
Definition: vector.h:371
#define Vc_ALWAYS_INLINE_R
Definition: macros.h:132
Vc::AVX::Mask< Size, sizeof(VectorType)> Mask
Definition: vector.h:60
Vc_ALWAYS_INLINE Vc_PURE VectorType & v()
Definition: storage.h:83
static Vc_INTRINSIC VectorType _cast(param128d v)
Definition: vector.h:81
#define F(x, y, z)
Vc_ALWAYS_INLINE Vector & operator++()
Definition: vector.h:226
#define VC_ALIGNED_PARAMETER(_Type)
Definition: macros.h:368
Vc_ALWAYS_INLINE WriteMaskedVector< T > operator()(const Mask &k)
Definition: vector.h:311
Vc_ALWAYS_INLINE_L Vc_PURE_L Vector< typename NegateTypeHelper< T >::Type > operator-() const Vc_ALWAYS_INLINE_R Vc_PURE_R
Vc_INTRINSIC void call(F &f, const Mask &mask) const
Definition: vector.h:365
ROOT::R::TRInterface & r
Definition: Object.C:4
void scatter(EntryType *mem, VC_ALIGNED_PARAMETER(Index) indexes) const
Vc_INTRINSIC_L Vc_PURE_L const Vector< T > & abcd() const Vc_INTRINSIC_R Vc_PURE_R
static Vc_INTRINSIC_L Vc_CONST_L Vector IndexesFromZero() Vc_INTRINSIC_R Vc_CONST_R
Vector< double > double_v
Definition: vector.h:416
SVector< double, 2 > v
Definition: Dict.h:5
static Vc_INTRINSIC VectorType _cast(param256 v)
Definition: vector.h:82
#define Vc_INTRINSIC_R
Definition: macros.h:141
static Vc_ALWAYS_INLINE Vector< T > round(const Vector< T > &x)
Definition: vector.h:452
#define OP_ENTRY(op)
Definition: vector.h:272
DetermineEntryType< T >::Type EntryType
Definition: vector.h:54
static Vc_ALWAYS_INLINE_L Vector Random() Vc_ALWAYS_INLINE_R
TMarker * m
Definition: textangle.C:8
Vc_ALWAYS_INLINE Vector & operator=(EntryType a)
Definition: vector.h:129
Vc_INTRINSIC_L Vc_PURE_L const Vector< T > badc() const Vc_INTRINSIC_R Vc_PURE_R
static Vc_ALWAYS_INLINE Vc_PURE Vector< T > rsqrt(const Vector< T > &x)
Definition: vector.h:523
Vc_INTRINSIC void call(const F &f) const
Definition: vector.h:349
static Vc_ALWAYS_INLINE Vector< T > rsqrt(const Vector< T > &x)
Definition: vector.h:449
Vc_INTRINSIC void fill(EntryType(&f)(IndexT))
Definition: vector.h:401
Type
enumeration specifying the integration types.
Vc_ALWAYS_INLINE Vector operator++(int)
Definition: vector.h:229
Vector & operator/=(EntryType x)
static Vc_ALWAYS_INLINE Vc_PURE Vector< T > reciprocal(const Vector< T > &x)
Definition: vector.h:525
#define blend
A helper class for fixed-size two-dimensional arrays.
Definition: memory.h:120
static Vc_ALWAYS_INLINE Vector< T >::Mask isnan(const Vector< T > &x)
Definition: vector.h:455
#define Vc_ALWAYS_INLINE
Definition: macros.h:130
RooCmdArg Index(RooCategory &icat)
static Vc_ALWAYS_INLINE Vc_PURE sfloat_v max(const sfloat_v &x, const sfloat_v &y)
Definition: vector.h:518
Vector< T > AsArg
Definition: vector.h:67
Vc_INTRINSIC_L Vc_PURE_L const Vector< T > dddd() const Vc_INTRINSIC_R Vc_PURE_R
Vector< typename IndexTypeHelper< T >::Type > IndexType
Definition: vector.h:59
Vc_ALWAYS_INLINE void assign(const Vector< T > &v, const Mask &mask)
Definition: vector.h:303
Vc_INTRINSIC_L void store(EntryType *mem) const Vc_INTRINSIC_R
Vc_ALWAYS_INLINE_L Vector< T > & operator<<=(int x) Vc_ALWAYS_INLINE_R
#define Vc_CONST_R
Definition: macros.h:135
#define Vc_ALWAYS_INLINE_L
Definition: macros.h:131
Vc_ALWAYS_INLINE Vector & operator=(AsArg v)
Definition: vector.h:123
Mask::AsArg MaskArg
Definition: vector.h:61
Vc_INTRINSIC_L Vector copySign(AsArg reference) const Vc_INTRINSIC_R
#define Vc_INTRINSIC_L
Definition: macros.h:140
const m128d param128d
Definition: intrinsics.h:126
void callWithValuesSorted(F &f)
Definition: vector.h:338
Vc_ALWAYS_INLINE Vector & operator--()
Definition: vector.h:227
Vc_ALWAYS_INLINE Vector()
Definition: vector.h:96
Vc_ALWAYS_INLINE EntryType min() const
Definition: vector.h:325
static Vc_ALWAYS_INLINE Vc_PURE sfloat_v min(const sfloat_v &x, const sfloat_v &y)
Definition: vector.h:515
cmpneq cmpnle OPcmp(<, cmplt) OPcmp(<
#define VC_ALL_SHIFTS(macro)
Definition: macros.h:357
StorageType d
Definition: vector.h:91
Vc_INTRINSIC_L Vc_PURE_L const Vector< T > dabc() const Vc_INTRINSIC_R Vc_PURE_R
Vc_INTRINSIC_L Vc_PURE_L const Vector< T > dcba() const Vc_INTRINSIC_R Vc_PURE_R
Vc_INTRINSIC_L void load(const EntryType *mem) Vc_INTRINSIC_R
Vc_INTRINSIC_L Vc_PURE_L const Vector< T > acbd() const Vc_INTRINSIC_R Vc_PURE_R
Vc_INTRINSIC Vector< T > apply(F &f) const
Definition: vector.h:378
Vc_INTRINSIC_L Vc_PURE_L const Vector< T > cccc() const Vc_INTRINSIC_R Vc_PURE_R
Vc_INTRINSIC_L Vector exponent() const Vc_INTRINSIC_R
Vc_ALWAYS_INLINE EntryType max() const
Definition: vector.h:326
Vc_ALWAYS_INLINE V2 staticCast() const
Definition: vector.h:308
float value
Definition: math.cpp:443
const m256 param256
Definition: intrinsics.h:128
Vc_ALWAYS_INLINE EntryType product() const
Definition: vector.h:327
Vc_ALWAYS_INLINE Vector operator--(int)
Definition: vector.h:230
static Vc_INTRINSIC VectorType _cast(param256d v)
Definition: vector.h:84
void fma()
Double_t * V2
Vc_ALWAYS_INLINE VectorType & data()
Definition: vector.h:322
const m128i param128i
Definition: intrinsics.h:127