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__) || defined(__NVCC__)) || (__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 // to be moved elsewhere
14 namespace mathSSE {
15  //
16  template <typename T>
17  inline bool samesign(T rh, T lh);
18 
19  template <>
20  inline bool __attribute__((always_inline)) __attribute__((pure)) samesign<int>(int rh, int lh) {
21  int const mask = 0x80000000;
22  return ((rh ^ lh) & mask) == 0;
23  }
24 
25  template <>
26  inline bool __attribute__((always_inline)) __attribute__((pure)) samesign<long long>(long long rh, long long lh) {
27  long long const mask = 0x8000000000000000LL;
28  return ((rh ^ lh) & mask) == 0;
29  }
30 
31  template <>
32  inline bool __attribute__((always_inline)) __attribute__((pure)) samesign<float>(float rh, float lh) {
33  union {
34  int i;
35  float f;
36  } a, b;
37  a.f = rh;
38  b.f = lh;
39  return samesign<int>(a.i, b.i);
40  }
41 
42  template <>
43  inline bool __attribute__((always_inline)) __attribute__((pure)) samesign<double>(double rh, double lh) {
44  union {
45  long long i;
46  double f;
47  } a, b;
48  a.f = rh;
49  b.f = lh;
50  return samesign<long long>(a.i, b.i);
51  }
52 } // namespace mathSSE
53 
54 #if defined(USE_EXTVECT)
56 #elif defined(USE_SSEVECT)
59 #endif
60 
61 #endif //
Definition: AVXVec.h:6
bool int lh
Definition: SIMDVec.h:20
constexpr uint32_t mask
Definition: gpuClustering.h:26
struct mathSSE::Rot3 __attribute__
return samesign< long long >(a.i, b.i)
return samesign< int >(a.i, b.i)
double b
Definition: hdecay.h:118
a f
Definition: SIMDVec.h:37
bool samesign(T rh, T lh)
double a
Definition: hdecay.h:119
long double T