Apply clang-format to source tree
[alexxy/gromacs.git] / src / gromacs / simd / impl_reference / impl_reference_simd_double.h
index ba4a1b82d0aaa54c61fb2ead1a742e4ec314a665..60fa0634b3f7a27ae872721eafcb01208d9ea806 100644 (file)
@@ -81,20 +81,20 @@ namespace gmx
  */
 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.
@@ -114,20 +114,20 @@ class SimdDouble
  */
 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.
@@ -141,20 +141,20 @@ class SimdDInt32
  */
 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.
@@ -168,20 +168,20 @@ class SimdDBool
  */
 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_;
 };
 
 /*! \}
@@ -195,14 +195,13 @@ class SimdDIBool
  * \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;
 }
 
@@ -211,10 +210,9 @@ simdLoad(const double *m, SimdDoubleTag = {})
  * \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);
 }
@@ -226,11 +224,10 @@ store(double *m, SimdDouble a)
  * \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;
 }
 
@@ -241,8 +238,7 @@ simdLoadU(const double *m, SimdDoubleTag = {})
  * \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);
 }
@@ -254,8 +250,7 @@ storeU(double *m, SimdDouble a)
  *
  * \return SIMD 0.0
  */
-static inline SimdDouble gmx_simdcall
-setZeroD()
+static inline SimdDouble gmx_simdcall setZeroD()
 {
     return SimdDouble(0.0);
 }
@@ -274,14 +269,13 @@ setZeroD()
  * \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;
 };
 
@@ -290,10 +284,9 @@ simdLoad(const std::int32_t * m, SimdDInt32Tag)
  * \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);
 };
@@ -308,11 +301,10 @@ store(std::int32_t * m, SimdDInt32 a)
  * \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;
 }
 
@@ -323,8 +315,7 @@ simdLoadU(const std::int32_t *m, SimdDInt32Tag)
  * \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);
 }
@@ -336,8 +327,7 @@ storeU(std::int32_t * m, SimdDInt32 a)
  *
  * \return SIMD 0
  */
-static inline SimdDInt32 gmx_simdcall
-setZeroDI()
+static inline SimdDInt32 gmx_simdcall setZeroDI()
 {
     return SimdDInt32(0);
 }
@@ -351,8 +341,7 @@ setZeroDI()
  * \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];
 }
@@ -371,17 +360,14 @@ extract(SimdDInt32 a)
  * \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++)
     {
@@ -401,17 +387,14 @@ operator&(SimdDouble a, SimdDouble b)
  * \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++)
     {
@@ -431,17 +414,14 @@ andNot(SimdDouble a, SimdDouble b)
  * \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++)
     {
@@ -461,17 +441,14 @@ operator|(SimdDouble a, SimdDouble b)
  * \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++)
     {
@@ -495,10 +472,9 @@ operator^(SimdDouble a, SimdDouble b)
  * \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++)
     {
@@ -513,10 +489,9 @@ operator+(SimdDouble a, SimdDouble b)
  * \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++)
     {
@@ -530,10 +505,9 @@ operator-(SimdDouble a, SimdDouble b)
  * \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++)
     {
@@ -548,10 +522,9 @@ operator-(SimdDouble a)
  * \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++)
     {
@@ -567,10 +540,9 @@ operator*(SimdDouble a, SimdDouble b)
  * \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.
@@ -580,10 +552,9 @@ fma(SimdDouble a, SimdDouble b, SimdDouble 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.
@@ -593,10 +564,9 @@ fms(SimdDouble a, SimdDouble b, SimdDouble 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.
@@ -606,10 +576,9 @@ fnma(SimdDouble a, SimdDouble b, SimdDouble 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.
@@ -620,10 +589,9 @@ fnms(SimdDouble a, SimdDouble b, SimdDouble c)
  * \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++)
     {
@@ -641,10 +609,9 @@ rsqrt(SimdDouble x)
  * \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++)
     {
@@ -661,10 +628,9 @@ rcp(SimdDouble x)
  * \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++)
     {
@@ -680,10 +646,9 @@ maskAdd(SimdDouble a, SimdDouble b, SimdDBool m)
  * \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++)
     {
@@ -700,14 +665,14 @@ maskzMul(SimdDouble a, SimdDouble b, SimdDBool m)
  * \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;
 }
@@ -722,15 +687,16 @@ maskzFma(SimdDouble a, SimdDouble b, SimdDouble c, SimdDBool m)
  * \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;
 }
@@ -745,14 +711,14 @@ maskzRsqrt(SimdDouble x, SimdDBool m)
  * \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;
 }
@@ -762,10 +728,9 @@ maskzRcp(SimdDouble x, SimdDBool m)
  * \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++)
     {
@@ -780,10 +745,9 @@ abs(SimdDouble a)
  * \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++)
     {
@@ -798,10 +762,9 @@ max(SimdDouble a, SimdDouble b)
  * \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++)
     {
@@ -818,10 +781,9 @@ min(SimdDouble a, SimdDouble b)
  * \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++)
     {
@@ -839,10 +801,9 @@ round(SimdDouble a)
  * 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++)
     {
@@ -857,8 +818,7 @@ trunc(SimdDouble a)
  * \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;
 
@@ -883,11 +843,10 @@ frexp(SimdDouble value, SimdDInt32 * exponent)
  * \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++)
     {
@@ -904,8 +863,7 @@ ldexp(SimdDouble value, SimdDInt32 exponent)
  * \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;
 
@@ -930,10 +888,9 @@ reduce(SimdDouble a)
  *
  * 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++)
     {
@@ -950,10 +907,9 @@ operator==(SimdDouble a, SimdDouble b)
  *
  * 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++)
     {
@@ -968,10 +924,9 @@ operator!=(SimdDouble a, SimdDouble b)
  * \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++)
     {
@@ -986,10 +941,9 @@ operator<(SimdDouble a, SimdDouble b)
  * \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++)
     {
@@ -1007,15 +961,13 @@ operator<=(SimdDouble a, SimdDouble b)
  * \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;
@@ -1035,10 +987,9 @@ testBits(SimdDouble a)
  * \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++)
     {
@@ -1057,10 +1008,9 @@ operator&&(SimdDBool a, SimdDBool b)
  * 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++)
     {
@@ -1077,8 +1027,7 @@ operator||(SimdDBool a, SimdDBool b)
  * 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;
 
@@ -1095,10 +1044,9 @@ anyTrue(SimdDBool a)
  * \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++)
     {
@@ -1113,10 +1061,9 @@ selectByMask(SimdDouble a, SimdDBool mask)
  * \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++)
     {
@@ -1132,10 +1079,9 @@ selectByNotMask(SimdDouble a, SimdDBool mask)
  * \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++)
     {
@@ -1162,10 +1108,9 @@ blend(SimdDouble a, SimdDouble b, SimdDBool sel)
  * \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++)
     {
@@ -1186,10 +1131,9 @@ operator&(SimdDInt32 a, SimdDInt32 b)
  * \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++)
     {
@@ -1206,10 +1150,9 @@ andNot(SimdDInt32 a, SimdDInt32 b)
  * \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++)
     {
@@ -1226,10 +1169,9 @@ operator|(SimdDInt32 a, SimdDInt32 b)
  * \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++)
     {
@@ -1252,10 +1194,9 @@ operator^(SimdDInt32 a, SimdDInt32 b)
  * \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++)
     {
@@ -1272,10 +1213,9 @@ operator+(SimdDInt32 a, SimdDInt32 b)
  * \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++)
     {
@@ -1294,10 +1234,9 @@ operator-(SimdDInt32 a, SimdDInt32 b)
  *
  * \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++)
     {
@@ -1320,10 +1259,9 @@ operator*(SimdDInt32 a, SimdDInt32 b)
  * \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++)
     {
@@ -1340,10 +1278,9 @@ operator==(SimdDInt32 a, SimdDInt32 b)
  * \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++)
     {
@@ -1359,10 +1296,9 @@ operator<(SimdDInt32 a, SimdDInt32 b)
  * \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++)
     {
@@ -1379,10 +1315,9 @@ testBits(SimdDInt32 a)
  * \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++)
     {
@@ -1399,10 +1334,9 @@ operator&&(SimdDIBool a, SimdDIBool b)
  * \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++)
     {
@@ -1421,8 +1355,7 @@ operator||(SimdDIBool a, SimdDIBool b)
  * \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;
 
@@ -1441,10 +1374,9 @@ anyTrue(SimdDIBool a)
  * \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++)
     {
@@ -1461,10 +1393,9 @@ selectByMask(SimdDInt32 a, SimdDIBool mask)
  * \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++)
     {
@@ -1482,10 +1413,9 @@ selectByNotMask(SimdDInt32 a, SimdDIBool mask)
  * \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++)
     {
@@ -1508,10 +1438,9 @@ blend(SimdDInt32 a, SimdDInt32 b, SimdDIBool sel)
  * \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++)
     {
@@ -1525,10 +1454,9 @@ cvtR2I(SimdDouble a)
  * \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++)
     {
@@ -1542,10 +1470,9 @@ cvttR2I(SimdDouble a)
  * \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++)
     {
@@ -1559,10 +1486,9 @@ cvtI2R(SimdDInt32 a)
  * \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++)
     {
@@ -1576,10 +1502,9 @@ cvtB2IB(SimdDBool a)
  * \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++)
     {
@@ -1600,11 +1525,10 @@ cvtIB2B(SimdDIBool a)
  * \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];
@@ -1627,11 +1551,10 @@ cvtF2D(SimdFloat gmx_unused f)
  * \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];
@@ -1655,14 +1578,15 @@ cvtD2F(SimdDouble gmx_unused d)
  * \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");
@@ -1682,15 +1606,14 @@ cvtF2DD(SimdFloat gmx_unused f, SimdDouble gmx_unused * d0, SimdDouble gmx_unuse
  * \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
@@ -1703,6 +1626,6 @@ cvtDD2F(SimdDouble gmx_unused d0, SimdDouble gmx_unused d1)
 /*! \} */
 /*! \endcond */
 
-}      // namespace gmx
+} // namespace gmx
 
 #endif // GMX_SIMD_IMPL_REFERENCE_SIMD_DOUBLE_H