/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
namespace gmx
{
-template <int align>
-static inline void gmx_simdcall
-gatherLoadTranspose(const double * base,
- const std::int32_t offset[],
- SimdDouble * v0,
- SimdDouble * v1,
- SimdDouble * v2,
- SimdDouble * v3)
+template<int align>
+static inline void gmx_simdcall gatherLoadTranspose(const double* base,
+ const std::int32_t offset[],
+ SimdDouble* v0,
+ SimdDouble* v1,
+ SimdDouble* v2,
+ SimdDouble* v3)
{
__vector double t1, t2, t3, t4;
- t1 = *reinterpret_cast<const __vector double *>(base + align * offset[0]);
- t2 = *reinterpret_cast<const __vector double *>(base + align * offset[1]);
- t3 = *reinterpret_cast<const __vector double *>(base + align * offset[0] + 2);
- t4 = *reinterpret_cast<const __vector double *>(base + align * offset[1] + 2);
+ t1 = *reinterpret_cast<const __vector double*>(base + align * offset[0]);
+ t2 = *reinterpret_cast<const __vector double*>(base + align * offset[1]);
+ t3 = *reinterpret_cast<const __vector double*>(base + align * offset[0] + 2);
+ t4 = *reinterpret_cast<const __vector double*>(base + align * offset[1] + 2);
v0->simdInternal_ = vec_mergeh(t1, t2);
v1->simdInternal_ = vec_mergel(t1, t2);
v2->simdInternal_ = vec_mergeh(t3, t4);
v3->simdInternal_ = vec_mergel(t3, t4);
-
}
-template <int align>
+template<int align>
static inline void gmx_simdcall
-gatherLoadTranspose(const double * base,
- const std::int32_t offset[],
- SimdDouble * v0,
- SimdDouble * v1)
+ gatherLoadTranspose(const double* base, const std::int32_t offset[], SimdDouble* v0, SimdDouble* v1)
{
__vector double t1, t2;
- t1 = *reinterpret_cast<const __vector double *>(base + align * offset[0]);
- t2 = *reinterpret_cast<const __vector double *>(base + align * offset[1]);
+ t1 = *reinterpret_cast<const __vector double*>(base + align * offset[0]);
+ t2 = *reinterpret_cast<const __vector double*>(base + align * offset[1]);
v0->simdInternal_ = vec_mergeh(t1, t2);
v1->simdInternal_ = vec_mergel(t1, t2);
-
}
static const int c_simdBestPairAlignmentDouble = 2;
-template <int align>
-static inline void gmx_simdcall
-gatherLoadUTranspose(const double * base,
- const std::int32_t offset[],
- SimdDouble * v0,
- SimdDouble * v1,
- SimdDouble * v2)
+template<int align>
+static inline void gmx_simdcall gatherLoadUTranspose(const double* base,
+ const std::int32_t offset[],
+ SimdDouble* v0,
+ SimdDouble* v1,
+ SimdDouble* v2)
{
- SimdDouble t1, t2;
+ SimdDouble t1, t2;
- t1 = simdLoad(base + align * offset[0]);
- t2 = simdLoad(base + align * offset[1]);
+ t1 = simdLoad(base + align * offset[0]);
+ t2 = simdLoad(base + align * offset[1]);
v0->simdInternal_ = vec_mergeh(t1.simdInternal_, t2.simdInternal_);
v1->simdInternal_ = vec_mergel(t1.simdInternal_, t2.simdInternal_);
}
// gcc-4.9 fails to recognize that the argument to vec_extract() is used
-template <int align>
-static inline void gmx_simdcall
-transposeScatterStoreU(double * base,
- const std::int32_t offset[],
- SimdDouble v0,
- SimdDouble v1,
- SimdDouble gmx_unused v2)
+template<int align>
+static inline void gmx_simdcall transposeScatterStoreU(double* base,
+ const std::int32_t offset[],
+ SimdDouble v0,
+ SimdDouble v1,
+ SimdDouble gmx_unused v2)
{
SimdDouble t1, t2;
t2.simdInternal_ = vec_mergel(v0.simdInternal_, v1.simdInternal_);
store(base + align * offset[0], t1);
- base[align * offset[0] + 2] = vec_extract(v2.simdInternal_, 0);
+ base[align * offset[0] + 2] = vec_extract(v2.simdInternal_, 0);
store(base + align * offset[1], t2);
- base[align * offset[1] + 2] = vec_extract(v2.simdInternal_, 1);
+ base[align * offset[1] + 2] = vec_extract(v2.simdInternal_, 1);
}
-template <int align>
+template<int align>
static inline void gmx_simdcall
-transposeScatterIncrU(double * base,
- const std::int32_t offset[],
- SimdDouble v0,
- SimdDouble v1,
- SimdDouble v2)
+ transposeScatterIncrU(double* base, const std::int32_t offset[], SimdDouble v0, SimdDouble v1, SimdDouble v2)
{
if (align % 4 == 0)
{
t1 = vec_mergeh(v0.simdInternal_, v1.simdInternal_);
t2 = vec_mergel(v0.simdInternal_, v1.simdInternal_);
- t3 = simdLoad(base + align * offset[0]);
- t3.simdInternal_ = vec_add(t3.simdInternal_, t1);
+ t3 = simdLoad(base + align * offset[0]);
+ t3.simdInternal_ = vec_add(t3.simdInternal_, t1);
store(base + align * offset[0], t3);
base[align * offset[0] + 2] += vec_extract(v2.simdInternal_, 0);
- t4 = simdLoad(base + align * offset[1]);
- t4.simdInternal_ = vec_add(t4.simdInternal_, t2);
+ t4 = simdLoad(base + align * offset[1]);
+ t4.simdInternal_ = vec_add(t4.simdInternal_, t2);
store(base + align * offset[1], t4);
base[align * offset[1] + 2] += vec_extract(v2.simdInternal_, 1);
}
}
-template <int align>
+template<int align>
static inline void gmx_simdcall
-transposeScatterDecrU(double * base,
- const std::int32_t offset[],
- SimdDouble v0,
- SimdDouble v1,
- SimdDouble v2)
+ transposeScatterDecrU(double* base, const std::int32_t offset[], SimdDouble v0, SimdDouble v1, SimdDouble v2)
{
if (align % 4 == 0)
{
t1 = vec_mergeh(v0.simdInternal_, v1.simdInternal_);
t2 = vec_mergel(v0.simdInternal_, v1.simdInternal_);
- t3 = simdLoad(base + align * offset[0]);
- t3.simdInternal_ = vec_sub(t3.simdInternal_, t1);
+ t3 = simdLoad(base + align * offset[0]);
+ t3.simdInternal_ = vec_sub(t3.simdInternal_, t1);
store(base + align * offset[0], t3);
base[align * offset[0] + 2] -= vec_extract(v2.simdInternal_, 0);
- t4 = simdLoad(base + align * offset[1]);
- t4.simdInternal_ = vec_sub(t4.simdInternal_, t2);
+ t4 = simdLoad(base + align * offset[1]);
+ t4.simdInternal_ = vec_sub(t4.simdInternal_, t2);
store(base + align * offset[1], t4);
base[align * offset[1] + 2] -= vec_extract(v2.simdInternal_, 1);
}
}
-static inline void gmx_simdcall
-expandScalarsToTriplets(SimdDouble scalar,
- SimdDouble * triplets0,
- SimdDouble * triplets1,
- SimdDouble * triplets2)
+static inline void gmx_simdcall expandScalarsToTriplets(SimdDouble scalar,
+ SimdDouble* triplets0,
+ SimdDouble* triplets1,
+ SimdDouble* triplets2)
{
triplets0->simdInternal_ = vec_mergeh(scalar.simdInternal_, scalar.simdInternal_);
triplets1->simdInternal_ = scalar.simdInternal_;
triplets2->simdInternal_ = vec_mergel(scalar.simdInternal_, scalar.simdInternal_);
}
-template <int align>
-static inline void gmx_simdcall
-gatherLoadBySimdIntTranspose(const double * base,
- SimdDInt32 offset,
- SimdDouble * v0,
- SimdDouble * v1,
- SimdDouble * v2,
- SimdDouble * v3)
+template<int align>
+static inline void gmx_simdcall gatherLoadBySimdIntTranspose(const double* base,
+ SimdDInt32 offset,
+ SimdDouble* v0,
+ SimdDouble* v1,
+ SimdDouble* v2,
+ SimdDouble* v3)
{
alignas(GMX_SIMD_ALIGNMENT) std::int32_t ioffset[GMX_SIMD_DINT32_WIDTH];
- store(ioffset, offset );
+ store(ioffset, offset);
gatherLoadTranspose<align>(base, ioffset, v0, v1, v2, v3);
}
-template <int align>
+template<int align>
static inline void gmx_simdcall
-gatherLoadBySimdIntTranspose(const double * base,
- SimdDInt32 offset,
- SimdDouble * v0,
- SimdDouble * v1)
+ gatherLoadBySimdIntTranspose(const double* base, SimdDInt32 offset, SimdDouble* v0, SimdDouble* v1)
{
alignas(GMX_SIMD_ALIGNMENT) std::int32_t ioffset[GMX_SIMD_DINT32_WIDTH];
- store(ioffset, offset );
+ store(ioffset, offset);
gatherLoadTranspose<align>(base, ioffset, v0, v1);
}
-template <int align>
+template<int align>
static inline void gmx_simdcall
-gatherLoadUBySimdIntTranspose(const double * base,
- SimdDInt32 offset,
- SimdDouble * v0,
- SimdDouble * v1)
+ gatherLoadUBySimdIntTranspose(const double* base, SimdDInt32 offset, SimdDouble* v0, SimdDouble* v1)
{
alignas(GMX_SIMD_ALIGNMENT) std::int32_t ioffset[GMX_SIMD_DINT32_WIDTH];
}
static inline double gmx_simdcall
-reduceIncr4ReturnSum(double * m,
- SimdDouble v0,
- SimdDouble v1,
- SimdDouble v2,
- SimdDouble v3)
+ reduceIncr4ReturnSum(double* m, SimdDouble v0, SimdDouble v1, SimdDouble v2, SimdDouble v3)
{
__vector double t1, t2, t3, t4;
t1 = vec_add(t1, t2);
t3 = vec_add(t3, t4);
- *reinterpret_cast<__vector double *>(m) += t1;
- *reinterpret_cast<__vector double *>(m+2) += t3;
+ *reinterpret_cast<__vector double*>(m) += t1;
+ *reinterpret_cast<__vector double*>(m + 2) += t3;
t1 = vec_add(t1, t3);
return reduce(t1);
}
-} // namespace gmx
+} // namespace gmx
#endif // GMX_SIMD_IMPLEMENTATION_IBM_VSX_UTIL_DOUBLE_H