Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
#ifndef DataFormat_Math_SIMDVec_H
#define DataFormat_Math_SIMDVec_H
//
//  For sustenaibility prefer the use of hte implementation based on the extended vector syntax
//  supported by gcc and clang on all architectures
//
//
#if (defined(__CLING__) || defined(__MIC__) || defined(__NVCC__)) || (__BIGGEST_ALIGNMENT__ < 16)
#elif defined(__INTEL_COMPILER)
// intel compiler does not support the extended vector syntax
#define USE_SSEVECT
#elif defined(__GNUC__) || defined(__clang__)
#if defined(__x86_64__) && defined(__SSE__) && defined(CMS_PREFER_SSEVECT)
#define USE_SSEVECT
#else
#define USE_EXTVECT
#endif
#endif

// to be moved elsewhere
namespace mathSSE {
  //
  template <typename T>
  inline bool samesign(T rh, T lh);

  template <>
  inline bool __attribute__((always_inline)) __attribute__((pure)) samesign<int>(int rh, int lh) {
    int const mask = 0x80000000;
    return ((rh ^ lh) & mask) == 0;
  }

  template <>
  inline bool __attribute__((always_inline)) __attribute__((pure)) samesign<long long>(long long rh, long long lh) {
    long long const mask = 0x8000000000000000LL;
    return ((rh ^ lh) & mask) == 0;
  }

  template <>
  inline bool __attribute__((always_inline)) __attribute__((pure)) samesign<float>(float rh, float lh) {
    union {
      int i;
      float f;
    } a, b;
    a.f = rh;
    b.f = lh;
    return samesign<int>(a.i, b.i);
  }

  template <>
  inline bool __attribute__((always_inline)) __attribute__((pure)) samesign<double>(double rh, double lh) {
    union {
      long long i;
      double f;
    } a, b;
    a.f = rh;
    b.f = lh;
    return samesign<long long>(a.i, b.i);
  }
}  // namespace mathSSE

#if defined(USE_EXTVECT)
#include "DataFormats/Math/interface/ExtVec.h"
#elif defined(USE_SSEVECT)
#if !defined(CMS_PREFER_SSEVECT) || !defined(__INTEL_COMPILER)
#warning "using SSEVECT even if not requirested?????"
#endif
#include "DataFormats/Math/interface/SSEVec.h"
#include "DataFormats/Math/interface/SSERot.h"
#endif

#endif  //