12 #ifndef MFEM_SIMD_AUTO_HPP
13 #define MFEM_SIMD_AUTO_HPP
15 #include "../../config/tconfig.hpp"
21 #define MFEM_AUTOSIMD_ALIGN__ alignas(align_bytes_)
23 template <
typename scalar_t,
int S,
int align_bytes_>
27 static const int size = S;
28 static const int align_bytes = align_bytes_;
41 inline MFEM_ALWAYS_INLINE
const scalar_t &
operator[](
int i)
const
49 for (
int i = 0; i < size; i++) { vec[i] = v[i]; }
56 for (
int i = 0; i < size; i++) { vec[i] = e; }
63 for (
int i = 0; i < size; i++) { vec[i] += v[i]; }
70 for (
int i = 0; i < size; i++) { vec[i] += e; }
77 for (
int i = 0; i < size; i++) { vec[i] -= v[i]; }
84 for (
int i = 0; i < size; i++) { vec[i] -= e; }
91 for (
int i = 0; i < size; i++) { vec[i] *= v[i]; }
98 for (
int i = 0; i < size; i++) { vec[i] *= e; }
105 for (
int i = 0; i < size; i++) { vec[i] /= v[i]; }
112 for (
int i = 0; i < size; i++) { vec[i] /= e; }
120 for (
int i = 0; i < size; i++) { r[i] = -vec[i]; }
133 for (
int i = 0; i < size; i++) { r[i] = vec[i] + v[i]; }
141 for (
int i = 0; i < size; i++) { r[i] = vec[i] + e; }
149 for (
int i = 0; i < size; i++) { r[i] = vec[i] - v[i]; }
157 for (
int i = 0; i < size; i++) { r[i] = vec[i] - e; }
165 for (
int i = 0; i < size; i++) { r[i] = vec[i] * v[i]; }
173 for (
int i = 0; i < size; i++) { r[i] = vec[i] * e; }
181 for (
int i = 0; i < size; i++) { r[i] = vec[i] / v[i]; }
189 for (
int i = 0; i < size; i++) { r[i] = vec[i] / e; }
196 for (
int i = 0; i < size; i++) { vec[i] += v[i] * w[i]; }
203 for (
int i = 0; i < size; i++) { vec[i] += v[i] * e; }
210 for (
int i = 0; i < size; i++) { vec[i] += e * v[i]; }
217 for (
int i = 0; i < size; i++) { vec[i] = v[i] * w[i]; }
224 for (
int i = 0; i < size; i++) { vec[i] = v[i] * e; }
231 for (
int i = 0; i < size; i++) { vec[i] = e * v[i]; }
236 template <
typename scalar_t,
int S,
int A>
237 inline MFEM_ALWAYS_INLINE
243 for (
int i = 0; i < S; i++) { r[i] = e + v[i]; }
247 template <
typename scalar_t,
int S,
int A>
248 inline MFEM_ALWAYS_INLINE
254 for (
int i = 0; i < S; i++) { r[i] = e - v[i]; }
258 template <
typename scalar_t,
int S,
int A>
259 inline MFEM_ALWAYS_INLINE
265 for (
int i = 0; i < S; i++) { r[i] = e * v[i]; }
269 template <
typename scalar_t,
int S,
int A>
270 inline MFEM_ALWAYS_INLINE
276 for (
int i = 0; i < S; i++) { r[i] = e / v[i]; }
282 #endif // MFEM_SIMD_AUTO_HPP
MFEM_ALWAYS_INLINE AutoSIMD & operator-=(const scalar_t &e)
MFEM_ALWAYS_INLINE AutoSIMD & operator*=(const scalar_t &e)
MFEM_ALWAYS_INLINE AutoSIMD operator+(const AutoSIMD &v) const
MFEM_ALWAYS_INLINE AutoSIMD operator*(const scalar_t &e) const
MFEM_ALWAYS_INLINE AutoSIMD< scalar_t, S, A > operator/(const scalar_t &e, const AutoSIMD< scalar_t, S, A > &v)
MFEM_ALWAYS_INLINE AutoSIMD operator-(const scalar_t &e) const
MFEM_ALWAYS_INLINE AutoSIMD & operator-=(const AutoSIMD &v)
MFEM_ALWAYS_INLINE AutoSIMD< scalar_t, S, A > operator+(const scalar_t &e, const AutoSIMD< scalar_t, S, A > &v)
MFEM_ALWAYS_INLINE AutoSIMD operator/(const scalar_t &e) const
MFEM_ALWAYS_INLINE AutoSIMD operator-(const AutoSIMD &v) const
MFEM_ALWAYS_INLINE AutoSIMD & operator+=(const AutoSIMD &v)
MFEM_ALWAYS_INLINE AutoSIMD operator+(const scalar_t &e) const
MFEM_ALWAYS_INLINE AutoSIMD & operator*=(const AutoSIMD &v)
MFEM_ALWAYS_INLINE AutoSIMD & operator=(const AutoSIMD &v)
MFEM_ALWAYS_INLINE AutoSIMD & operator/=(const scalar_t &e)
MFEM_ALWAYS_INLINE AutoSIMD & mul(const AutoSIMD &v, const AutoSIMD &w)
MFEM_ALWAYS_INLINE AutoSIMD & operator+=(const scalar_t &e)
MFEM_ALWAYS_INLINE const scalar_t & operator[](int i) const
MFEM_ALWAYS_INLINE AutoSIMD & mul(const AutoSIMD &v, const scalar_t &e)
MFEM_ALWAYS_INLINE scalar_t & operator[](int i)
MFEM_ALWAYS_INLINE AutoSIMD & fma(const scalar_t &e, const AutoSIMD &v)
MFEM_ALWAYS_INLINE AutoSIMD operator*(const AutoSIMD &v) const
MFEM_ALWAYS_INLINE AutoSIMD & mul(const scalar_t &e, const AutoSIMD &v)
MFEM_ALWAYS_INLINE AutoSIMD & fma(const AutoSIMD &v, const AutoSIMD &w)
MFEM_ALWAYS_INLINE AutoSIMD & operator/=(const AutoSIMD &v)
MFEM_ALWAYS_INLINE AutoSIMD & fma(const AutoSIMD &v, const scalar_t &e)
MFEM_ALWAYS_INLINE AutoSIMD operator+() const
MFEM_ALWAYS_INLINE AutoSIMD operator-() const
MemoryClass operator*(MemoryClass mc1, MemoryClass mc2)
Return a suitable MemoryClass from a pair of MemoryClasses.
MFEM_ALWAYS_INLINE AutoSIMD & operator=(const scalar_t &e)
MFEM_ALWAYS_INLINE AutoSIMD< scalar_t, S, A > operator-(const scalar_t &e, const AutoSIMD< scalar_t, S, A > &v)
MFEM_ALWAYS_INLINE AutoSIMD operator/(const AutoSIMD &v) const