ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
const.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 VC_AVX_CONST_H
21 #define VC_AVX_CONST_H
22 
23 #include <cstddef>
24 #include "const_data.h"
25 #include "macros.h"
26 
27 namespace ROOT {
28 namespace Vc
29 {
30 namespace AVX
31 {
32  template<typename T> class Vector;
33 
34  template<typename T> struct IndexesFromZeroData;
35  template<> struct IndexesFromZeroData<int> {
36  static Vc_ALWAYS_INLINE Vc_CONST const int *address() { return reinterpret_cast<const int *>(&_IndexesFromZero32[0]); }
37  };
38  template<> struct IndexesFromZeroData<unsigned int> {
39  static Vc_ALWAYS_INLINE Vc_CONST const unsigned int *address() { return &_IndexesFromZero32[0]; }
40  };
41  template<> struct IndexesFromZeroData<short> {
42  static Vc_ALWAYS_INLINE Vc_CONST const short *address() { return reinterpret_cast<const short *>(&_IndexesFromZero16[0]); }
43  };
44  template<> struct IndexesFromZeroData<unsigned short> {
45  static Vc_ALWAYS_INLINE Vc_CONST const unsigned short *address() { return &_IndexesFromZero16[0]; }
46  };
47  template<> struct IndexesFromZeroData<signed char> {
48  static Vc_ALWAYS_INLINE Vc_CONST const signed char *address() { return reinterpret_cast<const signed char *>(&_IndexesFromZero8[0]); }
49  };
50  template<> struct IndexesFromZeroData<char> {
51  static Vc_ALWAYS_INLINE Vc_CONST const char *address() { return reinterpret_cast<const char *>(&_IndexesFromZero8[0]); }
52  };
53  template<> struct IndexesFromZeroData<unsigned char> {
54  static Vc_ALWAYS_INLINE Vc_CONST const unsigned char *address() { return &_IndexesFromZero8[0]; }
55  };
56 
57  template<typename _T> struct Const
58  {
59  typedef Vector<_T> V;
60  typedef typename V::EntryType T;
61  typedef typename V::Mask M;
62 
63  static Vc_ALWAYS_INLINE Vc_CONST V _pi_4() { return V(c_trig<T>::data[0]); }
67  static Vc_ALWAYS_INLINE Vc_CONST V _1_16() { return V(c_trig<T>::data[4]); }
68  static Vc_ALWAYS_INLINE Vc_CONST V _16() { return V(c_trig<T>::data[5]); }
69 
70  static Vc_ALWAYS_INLINE Vc_CONST V cosCoeff(int i) { return V(c_trig<T>::data[( 8 + i)]); }
71  static Vc_ALWAYS_INLINE Vc_CONST V sinCoeff(int i) { return V(c_trig<T>::data[(14 + i)]); }
72  static Vc_ALWAYS_INLINE Vc_CONST V atanP(int i) { return V(c_trig<T>::data[(24 + i)]); }
73  static Vc_ALWAYS_INLINE Vc_CONST V atanQ(int i) { return V(c_trig<T>::data[(29 + i)]); }
78  static Vc_ALWAYS_INLINE Vc_CONST V _4_pi() { return V(c_trig<T>::data[21]); }
79  static Vc_ALWAYS_INLINE Vc_CONST V _pi_2() { return V(c_trig<T>::data[22]); }
80  static Vc_ALWAYS_INLINE Vc_CONST V _pi() { return V(c_trig<T>::data[23]); }
81  static Vc_ALWAYS_INLINE Vc_CONST V asinCoeff0(int i) { return V(c_trig<T>::data[(40 + i)]); }
82  static Vc_ALWAYS_INLINE Vc_CONST V asinCoeff1(int i) { return V(c_trig<T>::data[(45 + i)]); }
83  static Vc_ALWAYS_INLINE Vc_CONST V asinCoeff2(int i) { return V(c_trig<T>::data[(49 + i)]); }
84  static Vc_ALWAYS_INLINE Vc_CONST V asinCoeff3(int i) { return V(c_trig<T>::data[(55 + i)]); }
87 
88  static Vc_ALWAYS_INLINE Vc_CONST M exponentMask() { return M(V(c_log<T>::d(1)).data()); }
89  static Vc_ALWAYS_INLINE Vc_CONST V _1_2() { return V(c_log<T>::d(18)); }
90  static Vc_ALWAYS_INLINE Vc_CONST V _1_sqrt2() { return V(c_log<T>::d(15)); }
91  static Vc_ALWAYS_INLINE Vc_CONST V P(int i) { return V(c_log<T>::d(2 + i)); }
92  static Vc_ALWAYS_INLINE Vc_CONST V Q(int i) { return V(c_log<T>::d(8 + i)); }
93  static Vc_ALWAYS_INLINE Vc_CONST V min() { return V(c_log<T>::d(14)); }
94  static Vc_ALWAYS_INLINE Vc_CONST V ln2_small() { return V(c_log<T>::d(17)); }
95  static Vc_ALWAYS_INLINE Vc_CONST V ln2_large() { return V(c_log<T>::d(16)); }
96  static Vc_ALWAYS_INLINE Vc_CONST V neginf() { return V(c_log<T>::d(13)); }
97  static Vc_ALWAYS_INLINE Vc_CONST V log10_e() { return V(c_log<T>::d(19)); }
98  static Vc_ALWAYS_INLINE Vc_CONST V log2_e() { return V(c_log<T>::d(20)); }
99 
101  };
102 
103  template<> Vc_ALWAYS_INLINE Vc_CONST Vector<float> Const<float>::highMask() { return _mm256_broadcast_ss(reinterpret_cast<const float *>(&c_general::highMaskFloat)); }
104  template<> Vc_ALWAYS_INLINE Vc_CONST Vector<double> Const<double>::highMask() { return _mm256_broadcast_sd(reinterpret_cast<const double *>(&c_general::highMaskDouble)); }
105  template<> Vc_ALWAYS_INLINE Vc_CONST Vector<sfloat> Const<sfloat>::highMask() { return _mm256_broadcast_ss(reinterpret_cast<const float *>(&c_general::highMaskFloat)); }
106 } // namespace AVX
107 } // namespace Vc
108 } // namespace ROOT
109 
110 #include "undomacros.h"
111 
112 #endif // VC_AVX_CONST_H
static Vc_ALWAYS_INLINE Vc_CONST const unsigned short * address()
Definition: const.h:45
static Vc_ALWAYS_INLINE Vc_CONST const unsigned char * address()
Definition: const.h:54
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
static Vc_ALWAYS_INLINE Vc_CONST V atanQ(int i)
Definition: const.h:73
V::EntryType T
Definition: const.h:60
static Vc_ALWAYS_INLINE Vc_CONST const signed char * address()
Definition: const.h:48
static Vc_ALWAYS_INLINE Vc_CONST V atanThrsLo()
Definition: const.h:75
static Vc_ALWAYS_INLINE Vc_CONST V log10_e()
Definition: const.h:97
static Vc_ALWAYS_INLINE Vc_CONST V asinCoeff1(int i)
Definition: const.h:82
static Vc_ALWAYS_INLINE Vc_CONST V Q(int i)
Definition: const.h:92
static Vc_ALWAYS_INLINE Vc_CONST V _pi_4_rem2()
Definition: const.h:66
static Vc_ALWAYS_INLINE Vc_CONST V sinCoeff(int i)
Definition: const.h:71
static Vc_ALWAYS_INLINE Vc_CONST V cosCoeff(int i)
Definition: const.h:70
static Vc_ALWAYS_INLINE_L Vc_CONST_L V highMask() Vc_ALWAYS_INLINE_R Vc_CONST_R
static Vc_ALWAYS_INLINE Vc_CONST V asinCoeff2(int i)
Definition: const.h:83
static Vc_ALWAYS_INLINE Vc_CONST V asinCoeff0(int i)
Definition: const.h:81
static Vc_ALWAYS_INLINE Vc_CONST V _pi_2()
Definition: const.h:79
static Vc_ALWAYS_INLINE Vc_CONST V _16()
Definition: const.h:68
static Vc_ALWAYS_INLINE Vc_CONST V ln2_large()
Definition: const.h:95
static Vc_ALWAYS_INLINE Vc_CONST V _pi_4_hi()
Definition: const.h:64
#define AVX
Definition: global.h:90
#define Vc_ALWAYS_INLINE_R
Definition: macros.h:132
static Vc_ALWAYS_INLINE Vc_CONST const unsigned int * address()
Definition: const.h:39
static Vc_ALWAYS_INLINE Vc_CONST V _1_16()
Definition: const.h:67
static Vc_ALWAYS_INLINE Vc_CONST V _1_sqrt2()
Definition: const.h:90
static Vc_ALWAYS_INLINE Vc_CONST V _pi_4_rem1()
Definition: const.h:65
static Vc_ALWAYS_INLINE Vc_CONST V atanP(int i)
Definition: const.h:72
static Vc_ALWAYS_INLINE Vc_CONST const short * address()
Definition: const.h:42
DetermineEntryType< T >::Type EntryType
Definition: vector.h:54
static Vc_ALWAYS_INLINE Vc_CONST V P(int i)
Definition: const.h:91
#define Vc_CONST
Definition: macros.h:133
static Vc_ALWAYS_INLINE Vc_CONST V lossThreshold()
Definition: const.h:77
static Vc_ALWAYS_INLINE Vc_CONST V log2_e()
Definition: const.h:98
Vector< _T > V
Definition: const.h:59
#define Vc_ALWAYS_INLINE
Definition: macros.h:130
static Vc_ALWAYS_INLINE Vc_CONST V _4_pi()
Definition: const.h:78
static Vc_ALWAYS_INLINE Vc_CONST V atanThrsHi()
Definition: const.h:74
static Vc_ALWAYS_INLINE Vc_CONST const int * address()
Definition: const.h:36
#define Vc_CONST_R
Definition: macros.h:135
#define Vc_ALWAYS_INLINE_L
Definition: macros.h:131
static Vc_ALWAYS_INLINE Vc_CONST V _1_2()
Definition: const.h:89
static Vc_ALWAYS_INLINE Vc_CONST V neginf()
Definition: const.h:96
static Vc_ALWAYS_INLINE Vc_CONST V _pi_4()
Definition: const.h:63
static Vc_ALWAYS_INLINE Vc_CONST V largeAsinInput()
Definition: const.h:86
static Vc_ALWAYS_INLINE Vc_CONST V asinCoeff3(int i)
Definition: const.h:84
static Vc_ALWAYS_INLINE Vc_CONST const char * address()
Definition: const.h:51
static Vc_ALWAYS_INLINE Vc_CONST V _pi()
Definition: const.h:80
static Vc_ALWAYS_INLINE Vc_CONST V min()
Definition: const.h:93
static Vc_ALWAYS_INLINE Vc_CONST M exponentMask()
Definition: const.h:88
static Vc_ALWAYS_INLINE Vc_CONST V smallAsinInput()
Definition: const.h:85
static Vc_ALWAYS_INLINE Vc_CONST V ln2_small()
Definition: const.h:94
static Vc_ALWAYS_INLINE Vc_CONST V _pi_2_rem()
Definition: const.h:76