CMS 3D CMS Logo

SIMDVec.h
Go to the documentation of this file.
1 #ifndef DataFormat_Math_SIMDVec_H
2 #define DataFormat_Math_SIMDVec_H
3 
4 #if ( defined(__CLING__) || defined(__MIC__)) || (__BIGGEST_ALIGNMENT__<16)
5 #elif defined(__GNUC__) || defined(__clang__) || defined(__INTEL_COMPILER)
6 # if defined(__x86_64__) && defined(__SSE__)
7 # define USE_SSEVECT
8 # else
9 # define USE_EXTVECT
10 # endif
11 #endif
12 
13 
14 // to be moved elsewhere
15 namespace mathSSE {
16  //
17  template<typename T> inline bool samesign(T rh, T lh);
18 
19  template<>
20  inline bool
21  __attribute__((always_inline)) __attribute__ ((pure)) samesign<int>(int rh, int lh) {
22  int const mask= 0x80000000;
23  return ((rh^lh)&mask) == 0;
24  }
25 
26  template<>
27  inline bool
28  __attribute__((always_inline)) __attribute__ ((pure)) samesign<long long>(long long rh, long long lh) {
29  long long const mask= 0x8000000000000000LL;
30  return ((rh^lh)&mask) == 0;
31  }
32 
33  template<>
34  inline bool
35  __attribute__((always_inline)) __attribute__ ((pure)) samesign<float>(float rh, float lh) {
36  union { int i; float f; } a, b;
37  a.f=rh; b.f=lh;
38  return samesign<int>(a.i,b.i);
39  }
40 
41  template<>
42  inline bool
43  __attribute__((always_inline)) __attribute__ ((pure)) samesign<double>(double rh, double lh) {
44  union { long long i; double f; } a, b;
45  a.f=rh; b.f=lh;
46  return samesign<long long>(a.i,b.i);
47  }
48 }
49 
50 
51 
52 #if defined(USE_EXTVECT)
54 #elif defined(USE_SSEVECT)
57 #endif
58 
59 #endif //
Definition: AVXVec.h:6
bool int lh
Definition: SIMDVec.h:21
struct mathSSE::Rot3 __attribute__
return samesign< long long >(a.i, b.i)
return samesign< int >(a.i, b.i)
double b
Definition: hdecay.h:120
a f
Definition: SIMDVec.h:37
bool samesign(T rh, T lh)
double a
Definition: hdecay.h:121
long double T