Main Page
Namespaces
Classes
Package Documentation
DataFormats
Math
interface
SSEArray.h
Go to the documentation of this file.
1
#ifndef DataFormat_Math_SSEArray_H
2
#define DataFormat_Math_SSEArray_H
3
4
5
#include "
DataFormats/Math/interface/SSEVec.h
"
6
#include<cmath>
7
8
#ifdef CMS_USE_SSE
9
namespace
mathSSE
{
10
11
// "vertical array"
12
template
<
typename
T,
size_t
S>
13
struct
ArrayTraits {
14
};
15
16
template
<
typename
T,
size_t
S>
17
struct
ArrayMask {
18
};
19
20
//FIXME avoid punning...
21
template
<>
22
struct
ArrayMask<
float
, 0> {
23
static
inline
Vec4<float>
value
() {
24
Vec4<float>
v
; v.setMask(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff);
25
return
v
;
26
}
27
};
28
template
<>
29
struct
ArrayMask<
float
,1> {
30
static
inline
Vec4<float>
value
() {
31
Vec4<float>
v
; v.setMask(0xffffffff, 0x0, 0x0, 0x0);
32
return
v
;
33
}
34
};
35
template
<>
36
struct
ArrayMask<
float
,2> {
37
static
inline
Vec4<float>
value
() {
38
Vec4<float>
v
; v.setMask(0xffffffff, 0xffffffff, 0x0, 0x0);
39
return
v
;
40
}
41
};
42
template
<>
43
struct
ArrayMask<
float
,3> {
44
static
inline
Vec4<float>
value
() {
45
Vec4<float>
v
; v.setMask(0xffffffff, 0xffffffff, 0xffffffff, 0x0);
46
return
v
;
47
}
48
};
49
50
template
<>
51
struct
ArrayMask<double, 0> {
52
static
inline
Vec2<double>
value
() {
53
Vec2<double>
v
; v.setMask(0xffffffffffffffffLL, 0xffffffffffffffffLL);
54
return
v
;
55
}
56
};
57
template
<>
58
struct
ArrayMask<double,1> {
59
static
inline
Vec2<double>
value
() {
60
Vec2<double>
v
; v.setMask(0xffffffffffffffffLL, 0x0LL);
61
return
v
;
62
}
63
};
64
65
66
template
<
size_t
S>
67
struct
ArrayTraits<
float
,
S
> {
68
typedef
float
Scalar
;
69
typedef
Vec4<float>
Vec;
70
static
const
size_t
size
=
S
;
71
static
const
size_t
ssesize = (
S
+3)/4;
72
static
const
size_t
arrsize = 4*ssesize;
73
static
inline
Vec maskLast() {
return
ArrayMask<Scalar,arrsize-size>::value
(); }
74
static
inline
Vec
__attribute__
((__always_inline__))
mask
(Vec
v
,
size_t
i
) {
75
return
(i==ssesize-1) ? maskLast()&v :
v
;
76
}
77
template
<
typename
F>
78
static
void
loop
(
F
f
) {
79
for
(
size_t
i=0; i!=ssesize-1;++
i
)
80
f
(i,
ArrayMask<Scalar,0>::value
());
81
f
(ssesize-1,maskLast());
82
}
83
};
84
85
template
<
size_t
S>
86
struct
ArrayTraits<double,
S
> {
87
typedef
double
Scalar
;
88
typedef
Vec2<double>
Vec;
89
static
const
size_t
size =
S
;
90
static
const
size_t
ssesize = (
S
+1)/2;
91
static
const
size_t
arrsize = 2*ssesize;
92
static
inline
Vec maskLast() {
return
ArrayMask<Scalar,arrsize-size>::value
();}
93
};
94
95
template
<
typename
T,
size_t
S>
96
union
Array {
97
typedef
ArrayTraits<T,S> Traits;
98
typedef
typename
Traits::Vec Vec;
99
typename
Vec::nativeType vec[Traits::ssesize];
100
T
__attribute__
((aligned(16))) arr[Traits::arrsize];
101
102
Vec
operator
[](
size_t
i) {
return
vec[
i
];}
103
Vec
const
&
operator[]
(
size_t
i)
const
{
return
reinterpret_cast<
Vec
const
&
>
(vec[
i
]);}
104
105
};
106
107
108
}
109
110
#endif // CMS_USE_SSE
111
#endif // DataFormat_Math_SSEArray_H
mathSSE
Definition:
AVXVec.h:6
findQualityFiles.size
size
Write out results.
Definition:
findQualityFiles.py:441
mps_fire.i
i
Definition:
mps_fire.py:269
heppy_loop.loop
loop
Definition:
heppy_loop.py:26
align::Scalar
double Scalar
Definition:
Definitions.h:27
Vec4
ExtVec< T, 4 > Vec4
Definition:
ExtVec.h:62
findQualityFiles.v
v
Definition:
findQualityFiles.py:177
Utilities.operator
operator
Definition:
Utilities.py:24
RecoTauDiscriminantConfiguration.mask
mask
Definition:
RecoTauDiscriminantConfiguration.py:72
S
Definition:
CSCDBL1TPParametersExtended.h:16
operator[]
T operator[](int i) const
Definition:
extBasic3DVector.h:232
objects.autophobj.float
float
Definition:
autophobj.py:147
mathSSE::__attribute__
struct mathSSE::Rot3 __attribute__
relativeConstraints.value
value
Definition:
relativeConstraints.py:52
Vec2
ExtVec< T, 2 > Vec2
Definition:
ExtVec.h:63
S
double S(const TLorentzVector &, const TLorentzVector &)
Definition:
Particle.cc:99
mathSSE::f
a f
Definition:
SIMDVec.h:37
F
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition:
blowfish.cc:281
T
long double T
Definition:
Basic3DVectorLD.h:66
SSEVec.h
Generated for CMSSW Reference Manual by
1.8.11