File indexing completed on 2023-03-17 10:50:36
0001 #ifndef DataFormat_Math_SIMDVec_H
0002 #define DataFormat_Math_SIMDVec_H
0003
0004 #if (defined(__CLING__) || defined(__MIC__) || defined(__NVCC__)) || (__BIGGEST_ALIGNMENT__ < 16)
0005 #elif defined(__GNUC__) || defined(__clang__) || defined(__INTEL_COMPILER)
0006 #if defined(__x86_64__) && defined(__SSE__)
0007 #define USE_SSEVECT
0008 #else
0009 #define USE_EXTVECT
0010 #endif
0011 #endif
0012
0013
0014 namespace mathSSE {
0015
0016 template <typename T>
0017 inline bool samesign(T rh, T lh);
0018
0019 template <>
0020 inline bool __attribute__((always_inline)) __attribute__((pure)) samesign<int>(int rh, int lh) {
0021 int const mask = 0x80000000;
0022 return ((rh ^ lh) & mask) == 0;
0023 }
0024
0025 template <>
0026 inline bool __attribute__((always_inline)) __attribute__((pure)) samesign<long long>(long long rh, long long lh) {
0027 long long const mask = 0x8000000000000000LL;
0028 return ((rh ^ lh) & mask) == 0;
0029 }
0030
0031 template <>
0032 inline bool __attribute__((always_inline)) __attribute__((pure)) samesign<float>(float rh, float lh) {
0033 union {
0034 int i;
0035 float f;
0036 } a, b;
0037 a.f = rh;
0038 b.f = lh;
0039 return samesign<int>(a.i, b.i);
0040 }
0041
0042 template <>
0043 inline bool __attribute__((always_inline)) __attribute__((pure)) samesign<double>(double rh, double lh) {
0044 union {
0045 long long i;
0046 double f;
0047 } a, b;
0048 a.f = rh;
0049 b.f = lh;
0050 return samesign<long long>(a.i, b.i);
0051 }
0052 }
0053
0054 #if defined(USE_EXTVECT)
0055 #include "DataFormats/Math/interface/ExtVec.h"
0056 #elif defined(USE_SSEVECT)
0057 #include "DataFormats/Math/interface/SSEVec.h"
0058 #include "DataFormats/Math/interface/SSERot.h"
0059 #endif
0060
0061 #endif