12#ifndef MFEM_SIMD_AUTO_HPP
13#define MFEM_SIMD_AUTO_HPP
21#define MFEM_AUTOSIMD_ALIGN__ alignas(align_bytes_)
23template <
typename scalar_t,
int S,
int align_
bytes_>
24struct MFEM_AUTOSIMD_ALIGN__ AutoSIMD
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]; }
236template <
typename scalar_t,
int S,
int A>
237inline MFEM_ALWAYS_INLINE
243 for (
int i = 0; i < S; i++) { r[i] = e + v[i]; }
247template <
typename scalar_t,
int S,
int A>
248inline MFEM_ALWAYS_INLINE
254 for (
int i = 0; i < S; i++) { r[i] = e - v[i]; }
258template <
typename scalar_t,
int S,
int A>
259inline MFEM_ALWAYS_INLINE
265 for (
int i = 0; i < S; i++) { r[i] = e * v[i]; }
269template <
typename scalar_t,
int S,
int A>
270inline MFEM_ALWAYS_INLINE
276 for (
int i = 0; i < S; i++) { r[i] = e / v[i]; }
MemoryClass operator*(MemoryClass mc1, MemoryClass mc2)
Return a suitable MemoryClass from a pair of MemoryClasses.
MFEM_ALWAYS_INLINE AutoSIMD< scalar_t, S, A > operator+(const scalar_t &e, const AutoSIMD< scalar_t, S, A > &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< 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 scalar_t &e)
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 scalar_t &e)
MFEM_ALWAYS_INLINE AutoSIMD & operator=(const AutoSIMD &v)
MFEM_ALWAYS_INLINE AutoSIMD operator-() const
AutoSIMD(const AutoSIMD &)=default
MFEM_ALWAYS_INLINE AutoSIMD operator+(const AutoSIMD &v) const
MFEM_ALWAYS_INLINE AutoSIMD operator-(const AutoSIMD &v) const
MFEM_ALWAYS_INLINE AutoSIMD & fma(const AutoSIMD &v, const AutoSIMD &w)
MFEM_ALWAYS_INLINE AutoSIMD & operator*=(const scalar_t &e)
MFEM_ALWAYS_INLINE scalar_t & operator[](int i)
MFEM_ALWAYS_INLINE AutoSIMD & fma(const AutoSIMD &v, const scalar_t &e)
MFEM_ALWAYS_INLINE AutoSIMD & fma(const scalar_t &e, const AutoSIMD &v)
MFEM_ALWAYS_INLINE AutoSIMD & operator-=(const AutoSIMD &v)
MFEM_ALWAYS_INLINE AutoSIMD & operator-=(const scalar_t &e)
MFEM_ALWAYS_INLINE AutoSIMD operator+() const
MFEM_ALWAYS_INLINE AutoSIMD & mul(const scalar_t &e, const AutoSIMD &v)
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 & mul(const AutoSIMD &v, const AutoSIMD &w)
MFEM_ALWAYS_INLINE const scalar_t & operator[](int i) const
MFEM_ALWAYS_INLINE AutoSIMD & operator*=(const AutoSIMD &v)
MFEM_ALWAYS_INLINE AutoSIMD & mul(const AutoSIMD &v, const scalar_t &e)
MFEM_ALWAYS_INLINE AutoSIMD & operator/=(const scalar_t &e)
MFEM_ALWAYS_INLINE AutoSIMD operator*(const scalar_t &e) const