*/
class SimdDouble
{
- public:
- SimdDouble() {}
-
- //! \brief Construct from scalar
- SimdDouble(double d) { simdInternal_.fill(d); }
-
- /*! \brief Internal SIMD data. Implementation dependent, don't touch.
- *
- * This has to be public to enable usage in combination with static inline
- * functions, but it should never, EVER, be accessed by any code outside
- * the corresponding implementation directory since the type will depend
- * on the architecture.
- */
- std::array<double, GMX_SIMD_DOUBLE_WIDTH> simdInternal_;
+public:
+ SimdDouble() {}
+
+ //! \brief Construct from scalar
+ SimdDouble(double d) { simdInternal_.fill(d); }
+
+ /*! \brief Internal SIMD data. Implementation dependent, don't touch.
+ *
+ * This has to be public to enable usage in combination with static inline
+ * functions, but it should never, EVER, be accessed by any code outside
+ * the corresponding implementation directory since the type will depend
+ * on the architecture.
+ */
+ std::array<double, GMX_SIMD_DOUBLE_WIDTH> simdInternal_;
};
/*! \libinternal \brief Integer SIMD variable type to use for conversions to/from double.
*/
class SimdDInt32
{
- public:
- SimdDInt32() {}
+public:
+ SimdDInt32() {}
- //! \brief Construct from scalar
- SimdDInt32(std::int32_t i) { simdInternal_.fill(i); }
+ //! \brief Construct from scalar
+ SimdDInt32(std::int32_t i) { simdInternal_.fill(i); }
- /*! \brief Internal SIMD data. Implementation dependent, don't touch.
- *
- * This has to be public to enable usage in combination with static inline
- * functions, but it should never, EVER, be accessed by any code outside
- * the corresponding implementation directory since the type will depend
- * on the architecture.
- */
- std::array<std::int32_t, GMX_SIMD_DINT32_WIDTH> simdInternal_;
+ /*! \brief Internal SIMD data. Implementation dependent, don't touch.
+ *
+ * This has to be public to enable usage in combination with static inline
+ * functions, but it should never, EVER, be accessed by any code outside
+ * the corresponding implementation directory since the type will depend
+ * on the architecture.
+ */
+ std::array<std::int32_t, GMX_SIMD_DINT32_WIDTH> simdInternal_;
};
/*! \libinternal \brief Boolean type for double SIMD data.
*/
class SimdDBool
{
- public:
- SimdDBool() {}
+public:
+ SimdDBool() {}
- //! \brief Construct from scalar bool
- SimdDBool(bool b) { simdInternal_.fill(b); }
+ //! \brief Construct from scalar bool
+ SimdDBool(bool b) { simdInternal_.fill(b); }
- /*! \brief Internal SIMD data. Implementation dependent, don't touch.
- *
- * This has to be public to enable usage in combination with static inline
- * functions, but it should never, EVER, be accessed by any code outside
- * the corresponding implementation directory since the type will depend
- * on the architecture.
- */
- std::array<bool, GMX_SIMD_DOUBLE_WIDTH> simdInternal_;
+ /*! \brief Internal SIMD data. Implementation dependent, don't touch.
+ *
+ * This has to be public to enable usage in combination with static inline
+ * functions, but it should never, EVER, be accessed by any code outside
+ * the corresponding implementation directory since the type will depend
+ * on the architecture.
+ */
+ std::array<bool, GMX_SIMD_DOUBLE_WIDTH> simdInternal_;
};
/*! \libinternal \brief Boolean type for integer datatypes corresponding to double SIMD.
*/
class SimdDIBool
{
- public:
- SimdDIBool() {}
+public:
+ SimdDIBool() {}
- //! \brief Construct from scalar
- SimdDIBool(bool b) { simdInternal_.fill(b); }
+ //! \brief Construct from scalar
+ SimdDIBool(bool b) { simdInternal_.fill(b); }
- /*! \brief Internal SIMD data. Implementation dependent, don't touch.
- *
- * This has to be public to enable usage in combination with static inline
- * functions, but it should never, EVER, be accessed by any code outside
- * the corresponding implementation directory since the type will depend
- * on the architecture.
- */
- std::array<bool, GMX_SIMD_DINT32_WIDTH> simdInternal_;
+ /*! \brief Internal SIMD data. Implementation dependent, don't touch.
+ *
+ * This has to be public to enable usage in combination with static inline
+ * functions, but it should never, EVER, be accessed by any code outside
+ * the corresponding implementation directory since the type will depend
+ * on the architecture.
+ */
+ std::array<bool, GMX_SIMD_DINT32_WIDTH> simdInternal_;
};
/*! \}
* \param m Pointer to memory aligned to the SIMD width.
* \return SIMD variable with data loaded.
*/
-static inline SimdDouble gmx_simdcall
-simdLoad(const double *m, SimdDoubleTag = {})
+static inline SimdDouble gmx_simdcall simdLoad(const double* m, SimdDoubleTag = {})
{
SimdDouble a;
- assert(std::size_t(m) % (a.simdInternal_.size()*sizeof(double)) == 0);
+ assert(std::size_t(m) % (a.simdInternal_.size() * sizeof(double)) == 0);
- std::copy(m, m+a.simdInternal_.size(), a.simdInternal_.begin());
+ std::copy(m, m + a.simdInternal_.size(), a.simdInternal_.begin());
return a;
}
* \param[out] m Pointer to memory, aligned to SIMD width.
* \param a SIMD variable to store
*/
-static inline void gmx_simdcall
-store(double *m, SimdDouble a)
+static inline void gmx_simdcall store(double* m, SimdDouble a)
{
- assert(std::size_t(m) % (a.simdInternal_.size()*sizeof(double)) == 0);
+ assert(std::size_t(m) % (a.simdInternal_.size() * sizeof(double)) == 0);
std::copy(a.simdInternal_.begin(), a.simdInternal_.end(), m);
}
* \param m Pointer to memory, no alignment requirement.
* \return SIMD variable with data loaded.
*/
-static inline SimdDouble gmx_simdcall
-simdLoadU(const double *m, SimdDoubleTag = {})
+static inline SimdDouble gmx_simdcall simdLoadU(const double* m, SimdDoubleTag = {})
{
SimdDouble a;
- std::copy(m, m+a.simdInternal_.size(), a.simdInternal_.begin());
+ std::copy(m, m + a.simdInternal_.size(), a.simdInternal_.begin());
return a;
}
* \param[out] m Pointer to memory, no alignment requirement.
* \param a SIMD variable to store.
*/
-static inline void gmx_simdcall
-storeU(double *m, SimdDouble a)
+static inline void gmx_simdcall storeU(double* m, SimdDouble a)
{
std::copy(a.simdInternal_.begin(), a.simdInternal_.end(), m);
}
*
* \return SIMD 0.0
*/
-static inline SimdDouble gmx_simdcall
-setZeroD()
+static inline SimdDouble gmx_simdcall setZeroD()
{
return SimdDouble(0.0);
}
* \param m Pointer to memory, aligned to (double) integer SIMD width.
* \return SIMD integer variable.
*/
-static inline SimdDInt32 gmx_simdcall
-simdLoad(const std::int32_t * m, SimdDInt32Tag)
+static inline SimdDInt32 gmx_simdcall simdLoad(const std::int32_t* m, SimdDInt32Tag)
{
SimdDInt32 a;
- assert(std::size_t(m) % (a.simdInternal_.size()*sizeof(std::int32_t)) == 0);
+ assert(std::size_t(m) % (a.simdInternal_.size() * sizeof(std::int32_t)) == 0);
- std::copy(m, m+a.simdInternal_.size(), a.simdInternal_.begin());
+ std::copy(m, m + a.simdInternal_.size(), a.simdInternal_.begin());
return a;
};
* \param m Memory aligned to (double) integer SIMD width.
* \param a SIMD (double) integer variable to store.
*/
-static inline void gmx_simdcall
-store(std::int32_t * m, SimdDInt32 a)
+static inline void gmx_simdcall store(std::int32_t* m, SimdDInt32 a)
{
- assert(std::size_t(m) % (a.simdInternal_.size()*sizeof(std::int32_t)) == 0);
+ assert(std::size_t(m) % (a.simdInternal_.size() * sizeof(std::int32_t)) == 0);
std::copy(a.simdInternal_.begin(), a.simdInternal_.end(), m);
};
* \param m Pointer to memory, no alignment requirements.
* \return SIMD integer variable.
*/
-static inline SimdDInt32 gmx_simdcall
-simdLoadU(const std::int32_t *m, SimdDInt32Tag)
+static inline SimdDInt32 gmx_simdcall simdLoadU(const std::int32_t* m, SimdDInt32Tag)
{
SimdDInt32 a;
- std::copy(m, m+a.simdInternal_.size(), a.simdInternal_.begin());
+ std::copy(m, m + a.simdInternal_.size(), a.simdInternal_.begin());
return a;
}
* \param m Memory pointer, no alignment requirements.
* \param a SIMD (double) integer variable to store.
*/
-static inline void gmx_simdcall
-storeU(std::int32_t * m, SimdDInt32 a)
+static inline void gmx_simdcall storeU(std::int32_t* m, SimdDInt32 a)
{
std::copy(a.simdInternal_.begin(), a.simdInternal_.end(), m);
}
*
* \return SIMD 0
*/
-static inline SimdDInt32 gmx_simdcall
-setZeroDI()
+static inline SimdDInt32 gmx_simdcall setZeroDI()
{
return SimdDInt32(0);
}
* \return Single integer from position index in SIMD variable.
*/
template<int index>
-static inline std::int32_t gmx_simdcall
-extract(SimdDInt32 a)
+static inline std::int32_t gmx_simdcall extract(SimdDInt32 a)
{
return a.simdInternal_[index];
}
* \param b data2
* \return data1 & data2
*/
-static inline SimdDouble gmx_simdcall
-operator&(SimdDouble a, SimdDouble b)
+static inline SimdDouble gmx_simdcall operator&(SimdDouble a, SimdDouble b)
{
- SimdDouble res;
+ SimdDouble res;
- union
- {
- double r;
- std::int64_t i;
- }
- conv1, conv2;
+ union {
+ double r;
+ std::int64_t i;
+ } conv1, conv2;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
* \param b data2
* \return (~data1) & data2
*/
-static inline SimdDouble gmx_simdcall
-andNot(SimdDouble a, SimdDouble b)
+static inline SimdDouble gmx_simdcall andNot(SimdDouble a, SimdDouble b)
{
- SimdDouble res;
+ SimdDouble res;
- union
- {
- double r;
- std::int64_t i;
- }
- conv1, conv2;
+ union {
+ double r;
+ std::int64_t i;
+ } conv1, conv2;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
* \param b data2
* \return data1 | data2
*/
-static inline SimdDouble gmx_simdcall
-operator|(SimdDouble a, SimdDouble b)
+static inline SimdDouble gmx_simdcall operator|(SimdDouble a, SimdDouble b)
{
- SimdDouble res;
+ SimdDouble res;
- union
- {
- double r;
- std::int64_t i;
- }
- conv1, conv2;
+ union {
+ double r;
+ std::int64_t i;
+ } conv1, conv2;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
* \param b data2
* \return data1 ^ data2
*/
-static inline SimdDouble gmx_simdcall
-operator^(SimdDouble a, SimdDouble b)
+static inline SimdDouble gmx_simdcall operator^(SimdDouble a, SimdDouble b)
{
- SimdDouble res;
+ SimdDouble res;
- union
- {
- double r;
- std::int64_t i;
- }
- conv1, conv2;
+ union {
+ double r;
+ std::int64_t i;
+ } conv1, conv2;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
* \param b term2
* \return a+b
*/
-static inline SimdDouble gmx_simdcall
-operator+(SimdDouble a, SimdDouble b)
+static inline SimdDouble gmx_simdcall operator+(SimdDouble a, SimdDouble b)
{
- SimdDouble res;
+ SimdDouble res;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
* \param b term2
* \return a-b
*/
-static inline SimdDouble gmx_simdcall
-operator-(SimdDouble a, SimdDouble b)
+static inline SimdDouble gmx_simdcall operator-(SimdDouble a, SimdDouble b)
{
- SimdDouble res;
+ SimdDouble res;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
* \param a SIMD double precision value
* \return -a
*/
-static inline SimdDouble gmx_simdcall
-operator-(SimdDouble a)
+static inline SimdDouble gmx_simdcall operator-(SimdDouble a)
{
- SimdDouble res;
+ SimdDouble res;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
* \param b factor2
* \return a*b.
*/
-static inline SimdDouble gmx_simdcall
-operator*(SimdDouble a, SimdDouble b)
+static inline SimdDouble gmx_simdcall operator*(SimdDouble a, SimdDouble b)
{
- SimdDouble res;
+ SimdDouble res;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
* \param c term
* \return a*b+c
*/
-static inline SimdDouble gmx_simdcall
-fma(SimdDouble a, SimdDouble b, SimdDouble c)
+static inline SimdDouble gmx_simdcall fma(SimdDouble a, SimdDouble b, SimdDouble c)
{
- return a*b+c;
+ return a * b + c;
}
/*! \brief SIMD double Fused-multiply-subtract. Result is a*b-c.
* \param c term
* \return a*b-c
*/
-static inline SimdDouble gmx_simdcall
-fms(SimdDouble a, SimdDouble b, SimdDouble c)
+static inline SimdDouble gmx_simdcall fms(SimdDouble a, SimdDouble b, SimdDouble c)
{
- return a*b-c;
+ return a * b - c;
}
/*! \brief SIMD double Fused-negated-multiply-add. Result is -a*b+c.
* \param c term
* \return -a*b+c
*/
-static inline SimdDouble gmx_simdcall
-fnma(SimdDouble a, SimdDouble b, SimdDouble c)
+static inline SimdDouble gmx_simdcall fnma(SimdDouble a, SimdDouble b, SimdDouble c)
{
- return c-a*b;
+ return c - a * b;
}
/*! \brief SIMD double Fused-negated-multiply-subtract. Result is -a*b-c.
* \param c term
* \return -a*b-c
*/
-static inline SimdDouble gmx_simdcall
-fnms(SimdDouble a, SimdDouble b, SimdDouble c)
+static inline SimdDouble gmx_simdcall fnms(SimdDouble a, SimdDouble b, SimdDouble c)
{
- return -a*b-c;
+ return -a * b - c;
}
/*! \brief double SIMD 1.0/sqrt(x) lookup.
* \param x Argument, x>0
* \return Approximation of 1/sqrt(x), accuracy is \ref GMX_SIMD_RSQRT_BITS.
*/
-static inline SimdDouble gmx_simdcall
-rsqrt(SimdDouble x)
+static inline SimdDouble gmx_simdcall rsqrt(SimdDouble x)
{
- SimdDouble res;
+ SimdDouble res;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
* \param x Argument, x!=0
* \return Approximation of 1/x, accuracy is \ref GMX_SIMD_RCP_BITS.
*/
-static inline SimdDouble gmx_simdcall
-rcp(SimdDouble x)
+static inline SimdDouble gmx_simdcall rcp(SimdDouble x)
{
- SimdDouble res;
+ SimdDouble res;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
* \param m mask
* \return a+b where mask is true, 0.0 otherwise.
*/
-static inline SimdDouble gmx_simdcall
-maskAdd(SimdDouble a, SimdDouble b, SimdDBool m)
+static inline SimdDouble gmx_simdcall maskAdd(SimdDouble a, SimdDouble b, SimdDBool m)
{
- SimdDouble res;
+ SimdDouble res;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
* \param m mask
* \return a*b where mask is true, 0.0 otherwise.
*/
-static inline SimdDouble gmx_simdcall
-maskzMul(SimdDouble a, SimdDouble b, SimdDBool m)
+static inline SimdDouble gmx_simdcall maskzMul(SimdDouble a, SimdDouble b, SimdDBool m)
{
- SimdDouble res;
+ SimdDouble res;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
* \param m mask
* \return a*b+c where mask is true, 0.0 otherwise.
*/
-static inline SimdDouble gmx_simdcall
-maskzFma(SimdDouble a, SimdDouble b, SimdDouble c, SimdDBool m)
+static inline SimdDouble gmx_simdcall maskzFma(SimdDouble a, SimdDouble b, SimdDouble c, SimdDBool m)
{
- SimdDouble res;
+ SimdDouble res;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
- res.simdInternal_[i] = m.simdInternal_[i] ? (a.simdInternal_[i] * b.simdInternal_[i] + c.simdInternal_[i]) : 0.0;
+ res.simdInternal_[i] =
+ m.simdInternal_[i] ? (a.simdInternal_[i] * b.simdInternal_[i] + c.simdInternal_[i]) : 0.0;
}
return res;
}
* \return Approximation of 1/sqrt(x), accuracy is \ref GMX_SIMD_RSQRT_BITS.
* The result for masked-out entries will be 0.0.
*/
-static inline SimdDouble gmx_simdcall
-maskzRsqrt(SimdDouble x, SimdDBool m)
+static inline SimdDouble gmx_simdcall maskzRsqrt(SimdDouble x, SimdDBool m)
{
- SimdDouble res;
+ SimdDouble res;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
// sic - we only use single precision for the lookup
- res.simdInternal_[i] = (m.simdInternal_[i] != 0) ? 1.0F / std::sqrt(static_cast<float>(x.simdInternal_[i])) : 0.0;
+ res.simdInternal_[i] = (m.simdInternal_[i] != 0)
+ ? 1.0F / std::sqrt(static_cast<float>(x.simdInternal_[i]))
+ : 0.0;
}
return res;
}
* \return Approximation of 1/x, accuracy is \ref GMX_SIMD_RCP_BITS.
* The result for masked-out entries will be 0.0.
*/
-static inline SimdDouble gmx_simdcall
-maskzRcp(SimdDouble x, SimdDBool m)
+static inline SimdDouble gmx_simdcall maskzRcp(SimdDouble x, SimdDBool m)
{
- SimdDouble res;
+ SimdDouble res;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
- res.simdInternal_[i] = (m.simdInternal_[i] != 0) ? 1.0F / static_cast<float>(x.simdInternal_[i]) : 0.0;
+ res.simdInternal_[i] =
+ (m.simdInternal_[i] != 0) ? 1.0F / static_cast<float>(x.simdInternal_[i]) : 0.0;
}
return res;
}
* \param a any floating point values
* \return fabs(a) for each element.
*/
-static inline SimdDouble gmx_simdcall
-abs(SimdDouble a)
+static inline SimdDouble gmx_simdcall abs(SimdDouble a)
{
- SimdDouble res;
+ SimdDouble res;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
* \param b Any floating-point value
* \return max(a,b) for each element.
*/
-static inline SimdDouble gmx_simdcall
-max(SimdDouble a, SimdDouble b)
+static inline SimdDouble gmx_simdcall max(SimdDouble a, SimdDouble b)
{
- SimdDouble res;
+ SimdDouble res;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
* \param b Any floating-point value
* \return min(a,b) for each element.
*/
-static inline SimdDouble gmx_simdcall
-min(SimdDouble a, SimdDouble b)
+static inline SimdDouble gmx_simdcall min(SimdDouble a, SimdDouble b)
{
- SimdDouble res;
+ SimdDouble res;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
* \note Round mode is implementation defined. The only guarantee is that it
* is consistent between rounding functions (round, cvtR2I).
*/
-static inline SimdDouble gmx_simdcall
-round(SimdDouble a)
+static inline SimdDouble gmx_simdcall round(SimdDouble a)
{
- SimdDouble res;
+ SimdDouble res;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
* is that truncation is virtually always present as a dedicated hardware
* instruction, but floor() frequently isn't.
*/
-static inline SimdDouble gmx_simdcall
-trunc(SimdDouble a)
+static inline SimdDouble gmx_simdcall trunc(SimdDouble a)
{
- SimdDouble res;
+ SimdDouble res;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
* \param[out] exponent Returned exponent of value, integer SIMD format.
* \return Fraction of value, floating-point SIMD format.
*/
-static inline SimdDouble gmx_simdcall
-frexp(SimdDouble value, SimdDInt32 * exponent)
+static inline SimdDouble gmx_simdcall frexp(SimdDouble value, SimdDInt32* exponent)
{
SimdDouble fraction;
* \param exponent Integer that will not overflow as 2^exponent.
* \return value*2^exponent
*/
-template <MathOptimization opt = MathOptimization::Safe>
-static inline SimdDouble gmx_simdcall
-ldexp(SimdDouble value, SimdDInt32 exponent)
+template<MathOptimization opt = MathOptimization::Safe>
+static inline SimdDouble gmx_simdcall ldexp(SimdDouble value, SimdDInt32 exponent)
{
- SimdDouble res;
+ SimdDouble res;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
* \return The sum of all elements in the argument variable.
*
*/
-static inline double gmx_simdcall
-reduce(SimdDouble a)
+static inline double gmx_simdcall reduce(SimdDouble a)
{
double sum = 0.0;
*
* Beware that exact floating-point comparisons are difficult.
*/
-static inline SimdDBool gmx_simdcall
-operator==(SimdDouble a, SimdDouble b)
+static inline SimdDBool gmx_simdcall operator==(SimdDouble a, SimdDouble b)
{
- SimdDBool res;
+ SimdDBool res;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
*
* Beware that exact floating-point comparisons are difficult.
*/
-static inline SimdDBool gmx_simdcall
-operator!=(SimdDouble a, SimdDouble b)
+static inline SimdDBool gmx_simdcall operator!=(SimdDouble a, SimdDouble b)
{
- SimdDBool res;
+ SimdDBool res;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
* \param b value2
* \return Each element of the boolean will be set to true if a<b.
*/
-static inline SimdDBool gmx_simdcall
-operator<(SimdDouble a, SimdDouble b)
+static inline SimdDBool gmx_simdcall operator<(SimdDouble a, SimdDouble b)
{
- SimdDBool res;
+ SimdDBool res;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
* \param b value2
* \return Each element of the boolean will be set to true if a<=b.
*/
-static inline SimdDBool gmx_simdcall
-operator<=(SimdDouble a, SimdDouble b)
+static inline SimdDBool gmx_simdcall operator<=(SimdDouble a, SimdDouble b)
{
- SimdDBool res;
+ SimdDBool res;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
* \param a value
* \return Each element of the boolean will be true if any bit in a is nonzero.
*/
-static inline SimdDBool gmx_simdcall
-testBits(SimdDouble a)
+static inline SimdDBool gmx_simdcall testBits(SimdDouble a)
{
- SimdDBool res;
+ SimdDBool res;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
- union
- {
+ union {
std::uint64_t i;
double d;
} conv;
* \note This is not necessarily a bitwise operation - the storage format
* of booleans is implementation-dependent.
*/
-static inline SimdDBool gmx_simdcall
-operator&&(SimdDBool a, SimdDBool b)
+static inline SimdDBool gmx_simdcall operator&&(SimdDBool a, SimdDBool b)
{
- SimdDBool res;
+ SimdDBool res;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
* of booleans is implementation-dependent.
*
\ */
-static inline SimdDBool gmx_simdcall
-operator||(SimdDBool a, SimdDBool b)
+static inline SimdDBool gmx_simdcall operator||(SimdDBool a, SimdDBool b)
{
- SimdDBool res;
+ SimdDBool res;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
* The actual return value for truth will depend on the architecture,
* so any non-zero value is considered truth.
*/
-static inline bool gmx_simdcall
-anyTrue(SimdDBool a)
+static inline bool gmx_simdcall anyTrue(SimdDBool a)
{
bool res = false;
* \param mask Boolean selector
* \return For each element, a is selected for true, 0 for false.
*/
-static inline SimdDouble gmx_simdcall
-selectByMask(SimdDouble a, SimdDBool mask)
+static inline SimdDouble gmx_simdcall selectByMask(SimdDouble a, SimdDBool mask)
{
- SimdDouble res;
+ SimdDouble res;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
* \param mask Boolean selector
* \return For each element, a is selected for false, 0 for true (sic).
*/
-static inline SimdDouble gmx_simdcall
-selectByNotMask(SimdDouble a, SimdDBool mask)
+static inline SimdDouble gmx_simdcall selectByNotMask(SimdDouble a, SimdDBool mask)
{
- SimdDouble res;
+ SimdDouble res;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
* \param sel Boolean selector
* \return For each element, select b if sel is true, a otherwise.
*/
-static inline SimdDouble gmx_simdcall
-blend(SimdDouble a, SimdDouble b, SimdDBool sel)
+static inline SimdDouble gmx_simdcall blend(SimdDouble a, SimdDouble b, SimdDBool sel)
{
- SimdDouble res;
+ SimdDouble res;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
* \param b second integer SIMD
* \return a \& b (bitwise and)
*/
-static inline SimdDInt32 gmx_simdcall
-operator&(SimdDInt32 a, SimdDInt32 b)
+static inline SimdDInt32 gmx_simdcall operator&(SimdDInt32 a, SimdDInt32 b)
{
- SimdDInt32 res;
+ SimdDInt32 res;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
* \param b integer SIMD
* \return (~a) & b
*/
-static inline SimdDInt32 gmx_simdcall
-andNot(SimdDInt32 a, SimdDInt32 b)
+static inline SimdDInt32 gmx_simdcall andNot(SimdDInt32 a, SimdDInt32 b)
{
- SimdDInt32 res;
+ SimdDInt32 res;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
* \param b second integer SIMD
* \return a \| b (bitwise or)
*/
-static inline SimdDInt32 gmx_simdcall
-operator|(SimdDInt32 a, SimdDInt32 b)
+static inline SimdDInt32 gmx_simdcall operator|(SimdDInt32 a, SimdDInt32 b)
{
- SimdDInt32 res;
+ SimdDInt32 res;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
* \param b second integer SIMD
* \return a ^ b (bitwise xor)
*/
-static inline SimdDInt32 gmx_simdcall
-operator^(SimdDInt32 a, SimdDInt32 b)
+static inline SimdDInt32 gmx_simdcall operator^(SimdDInt32 a, SimdDInt32 b)
{
- SimdDInt32 res;
+ SimdDInt32 res;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
* \param b term2
* \return a+b
*/
-static inline SimdDInt32 gmx_simdcall
-operator+(SimdDInt32 a, SimdDInt32 b)
+static inline SimdDInt32 gmx_simdcall operator+(SimdDInt32 a, SimdDInt32 b)
{
- SimdDInt32 res;
+ SimdDInt32 res;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
* \param b term2
* \return a-b
*/
-static inline SimdDInt32 gmx_simdcall
-operator-(SimdDInt32 a, SimdDInt32 b)
+static inline SimdDInt32 gmx_simdcall operator-(SimdDInt32 a, SimdDInt32 b)
{
- SimdDInt32 res;
+ SimdDInt32 res;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
*
* \note Only the low 32 bits are retained, so this can overflow.
*/
-static inline SimdDInt32 gmx_simdcall
-operator*(SimdDInt32 a, SimdDInt32 b)
+static inline SimdDInt32 gmx_simdcall operator*(SimdDInt32 a, SimdDInt32 b)
{
- SimdDInt32 res;
+ SimdDInt32 res;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
* \param b SIMD integer2
* \return SIMD integer boolean with true for elements where a==b
*/
-static inline SimdDIBool gmx_simdcall
-operator==(SimdDInt32 a, SimdDInt32 b)
+static inline SimdDIBool gmx_simdcall operator==(SimdDInt32 a, SimdDInt32 b)
{
- SimdDIBool res;
+ SimdDIBool res;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
* \param b SIMD integer2
* \return SIMD integer boolean with true for elements where a<b
*/
-static inline SimdDIBool gmx_simdcall
-operator<(SimdDInt32 a, SimdDInt32 b)
+static inline SimdDIBool gmx_simdcall operator<(SimdDInt32 a, SimdDInt32 b)
{
- SimdDIBool res;
+ SimdDIBool res;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
* \param a SIMD integer
* \return SIMD integer boolean with true for elements where any bit is set
*/
-static inline SimdDIBool gmx_simdcall
-testBits(SimdDInt32 a)
+static inline SimdDIBool gmx_simdcall testBits(SimdDInt32 a)
{
- SimdDIBool res;
+ SimdDIBool res;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
* \param b SIMD boolean 2
* \return True for elements where both a and b are true.
*/
-static inline SimdDIBool gmx_simdcall
-operator&&(SimdDIBool a, SimdDIBool b)
+static inline SimdDIBool gmx_simdcall operator&&(SimdDIBool a, SimdDIBool b)
{
- SimdDIBool res;
+ SimdDIBool res;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
* \param b SIMD boolean 2
* \return True for elements where both a and b are true.
*/
-static inline SimdDIBool gmx_simdcall
-operator||(SimdDIBool a, SimdDIBool b)
+static inline SimdDIBool gmx_simdcall operator||(SimdDIBool a, SimdDIBool b)
{
- SimdDIBool res;
+ SimdDIBool res;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
* \param a SIMD boolean
* \return True if any of the elements in a is true, otherwise 0.
*/
-static inline bool gmx_simdcall
-anyTrue(SimdDIBool a)
+static inline bool gmx_simdcall anyTrue(SimdDIBool a)
{
bool res = false;
* \param mask Boolean selector
* \return Elements from a where sel is true, 0 otherwise.
*/
-static inline SimdDInt32 gmx_simdcall
-selectByMask(SimdDInt32 a, SimdDIBool mask)
+static inline SimdDInt32 gmx_simdcall selectByMask(SimdDInt32 a, SimdDIBool mask)
{
- SimdDInt32 res;
+ SimdDInt32 res;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
* \param mask Boolean selector
* \return Elements from a where sel is false, 0 otherwise (sic).
*/
-static inline SimdDInt32 gmx_simdcall
-selectByNotMask(SimdDInt32 a, SimdDIBool mask)
+static inline SimdDInt32 gmx_simdcall selectByNotMask(SimdDInt32 a, SimdDIBool mask)
{
- SimdDInt32 res;
+ SimdDInt32 res;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
* \param sel Boolean selector
* \return For each element, select b if sel is true, a otherwise.
*/
-static inline SimdDInt32 gmx_simdcall
-blend(SimdDInt32 a, SimdDInt32 b, SimdDIBool sel)
+static inline SimdDInt32 gmx_simdcall blend(SimdDInt32 a, SimdDInt32 b, SimdDIBool sel)
{
- SimdDInt32 res;
+ SimdDInt32 res;
for (std::size_t i = 0; i < res.simdInternal_.size(); i++)
{
* \note Round mode is implementation defined. The only guarantee is that it
* is consistent between rounding functions (round, cvtR2I).
*/
-static inline SimdDInt32 gmx_simdcall
-cvtR2I(SimdDouble a)
+static inline SimdDInt32 gmx_simdcall cvtR2I(SimdDouble a)
{
- SimdDInt32 b;
+ SimdDInt32 b;
for (std::size_t i = 0; i < b.simdInternal_.size(); i++)
{
* \param a SIMD floating-point
* \return SIMD integer, truncated to nearest integer.
*/
-static inline SimdDInt32 gmx_simdcall
-cvttR2I(SimdDouble a)
+static inline SimdDInt32 gmx_simdcall cvttR2I(SimdDouble a)
{
- SimdDInt32 b;
+ SimdDInt32 b;
for (std::size_t i = 0; i < b.simdInternal_.size(); i++)
{
* \param a SIMD integer
* \return SIMD floating-point
*/
-static inline SimdDouble gmx_simdcall
-cvtI2R(SimdDInt32 a)
+static inline SimdDouble gmx_simdcall cvtI2R(SimdDInt32 a)
{
- SimdDouble b;
+ SimdDouble b;
for (std::size_t i = 0; i < b.simdInternal_.size(); i++)
{
* \param a SIMD floating-point boolean
* \return SIMD integer boolean
*/
-static inline SimdDIBool gmx_simdcall
-cvtB2IB(SimdDBool a)
+static inline SimdDIBool gmx_simdcall cvtB2IB(SimdDBool a)
{
- SimdDIBool b;
+ SimdDIBool b;
for (std::size_t i = 0; i < b.simdInternal_.size(); i++)
{
* \param a SIMD integer boolean
* \return SIMD floating-point boolean
*/
-static inline SimdDBool gmx_simdcall
-cvtIB2B(SimdDIBool a)
+static inline SimdDBool gmx_simdcall cvtIB2B(SimdDIBool a)
{
- SimdDBool b;
+ SimdDBool b;
for (std::size_t i = 0; i < b.simdInternal_.size(); i++)
{
* \param f Single-precision SIMD variable
* \return Double-precision SIMD variable of the same width
*/
-static inline SimdDouble gmx_simdcall
-cvtF2D(SimdFloat gmx_unused f)
+static inline SimdDouble gmx_simdcall cvtF2D(SimdFloat gmx_unused f)
{
#if (GMX_SIMD_FLOAT_WIDTH == GMX_SIMD_DOUBLE_WIDTH)
- SimdDouble d;
+ SimdDouble d;
for (std::size_t i = 0; i < d.simdInternal_.size(); i++)
{
d.simdInternal_[i] = f.simdInternal_[i];
* \param d Double-precision SIMD variable
* \return Single-precision SIMD variable of the same width
*/
-static inline SimdFloat gmx_simdcall
-cvtD2F(SimdDouble gmx_unused d)
+static inline SimdFloat gmx_simdcall cvtD2F(SimdDouble gmx_unused d)
{
#if (GMX_SIMD_FLOAT_WIDTH == GMX_SIMD_DOUBLE_WIDTH)
- SimdFloat f;
+ SimdFloat f;
for (std::size_t i = 0; i < f.simdInternal_.size(); i++)
{
f.simdInternal_[i] = d.simdInternal_[i];
* \param[out] d0 Double-precision SIMD variable, first half of values from f.
* \param[out] d1 Double-precision SIMD variable, second half of values from f.
*/
-static inline void gmx_simdcall
-cvtF2DD(SimdFloat gmx_unused f, SimdDouble gmx_unused * d0, SimdDouble gmx_unused * d1)
+static inline void gmx_simdcall cvtF2DD(SimdFloat gmx_unused f,
+ SimdDouble gmx_unused* d0,
+ SimdDouble gmx_unused* d1)
{
-#if (GMX_SIMD_FLOAT_WIDTH == 2*GMX_SIMD_DOUBLE_WIDTH)
+#if (GMX_SIMD_FLOAT_WIDTH == 2 * GMX_SIMD_DOUBLE_WIDTH)
for (std::size_t i = 0; i < d0->simdInternal_.size(); i++)
{
d0->simdInternal_[i] = f.simdInternal_[i];
- d1->simdInternal_[i] = f.simdInternal_[f.simdInternal_.size()/2 + i];
+ d1->simdInternal_[i] = f.simdInternal_[f.simdInternal_.size() / 2 + i];
}
#else
gmx_fatal(FARGS, "simdCvtF2DD() requires GMX_SIMD_FLOAT_WIDTH==2*GMX_SIMD_DOUBLE_WIDTH");
* \param d1 Double-precision SIMD variable, second half of values to put in f.
* \return Single-precision SIMD variable with all values.
*/
-static inline SimdFloat gmx_simdcall
-cvtDD2F(SimdDouble gmx_unused d0, SimdDouble gmx_unused d1)
+static inline SimdFloat gmx_simdcall cvtDD2F(SimdDouble gmx_unused d0, SimdDouble gmx_unused d1)
{
-#if (GMX_SIMD_FLOAT_WIDTH == 2*GMX_SIMD_DOUBLE_WIDTH)
- SimdFloat f;
+#if (GMX_SIMD_FLOAT_WIDTH == 2 * GMX_SIMD_DOUBLE_WIDTH)
+ SimdFloat f;
for (std::size_t i = 0; i < d0.simdInternal_.size(); i++)
{
- f.simdInternal_[i] = d0.simdInternal_[i];
- f.simdInternal_[f.simdInternal_.size()/2 + i] = d1.simdInternal_[i];
+ f.simdInternal_[i] = d0.simdInternal_[i];
+ f.simdInternal_[f.simdInternal_.size() / 2 + i] = d1.simdInternal_[i];
}
return f;
#else
/*! \} */
/*! \endcond */
-} // namespace gmx
+} // namespace gmx
#endif // GMX_SIMD_IMPL_REFERENCE_SIMD_DOUBLE_H