12#ifndef MFEM_SIMD_M128_HPP
13#define MFEM_SIMD_M128_HPP
18#if defined(__x86_64__)
27template <
typename,
int,
int>
struct AutoSIMD;
29template <>
struct AutoSIMD<double,2,16>
32 static constexpr int size = 2;
50 inline MFEM_ALWAYS_INLINE
const double &
operator[](
int i)
const
63 m128d = _mm_set1_pd(e);
69 m128d = _mm_add_pd(m128d,v.m128d);
75 m128d = _mm_add_pd(m128d,_mm_set1_pd(e));
81 m128d = _mm_sub_pd(m128d,v.m128d);
87 m128d = _mm_sub_pd(m128d,_mm_set1_pd(e));
93 m128d = _mm_mul_pd(m128d,v.m128d);
99 m128d = _mm_mul_pd(m128d,_mm_set1_pd(e));
105 m128d = _mm_div_pd(m128d,v.m128d);
111 m128d = _mm_div_pd(m128d,_mm_set1_pd(e));
118 r.m128d = _mm_xor_pd(_mm_set1_pd(-0.0), m128d);
130 r.m128d = _mm_add_pd(m128d,v.m128d);
138 r.m128d = _mm_add_pd(m128d, _mm_set1_pd(e));
145 r.m128d = _mm_sub_pd(m128d,v.m128d);
152 r.m128d = _mm_sub_pd(m128d, _mm_set1_pd(e));
159 r.m128d = _mm_mul_pd(m128d,v.m128d);
166 r.m128d = _mm_mul_pd(m128d, _mm_set1_pd(e));
173 r.m128d = _mm_div_pd(m128d,v.m128d);
180 r.m128d = _mm_div_pd(m128d, _mm_set1_pd(e));
187 m128d = _mm_add_pd(_mm_mul_pd(w.m128d,v.m128d),m128d);
193 m128d = _mm_add_pd(_mm_mul_pd(_mm_set1_pd(e),v.m128d),m128d);
199 m128d = _mm_add_pd(_mm_mul_pd(v.m128d,_mm_set1_pd(e)),m128d);
205 m128d = _mm_mul_pd(v.m128d,w.m128d);
211 m128d = _mm_mul_pd(v.m128d,_mm_set1_pd(e));
217 m128d = _mm_mul_pd(_mm_set1_pd(e),v.m128d);
222inline MFEM_ALWAYS_INLINE
227 r.m128d = _mm_add_pd(_mm_set1_pd(e),v.m128d);
231inline MFEM_ALWAYS_INLINE
236 r.m128d = _mm_sub_pd(_mm_set1_pd(e),v.m128d);
240inline MFEM_ALWAYS_INLINE
245 r.m128d = _mm_mul_pd(_mm_set1_pd(e),v.m128d);
249inline MFEM_ALWAYS_INLINE
254 r.m128d = _mm_div_pd(_mm_set1_pd(e),v.m128d);
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 AutoSIMD &v)
MFEM_ALWAYS_INLINE AutoSIMD & operator-=(const double &e)
MFEM_ALWAYS_INLINE AutoSIMD & operator/=(const AutoSIMD &v)
MFEM_ALWAYS_INLINE AutoSIMD operator+(const AutoSIMD &v) const
MFEM_ALWAYS_INLINE AutoSIMD & mul(const AutoSIMD &v, const AutoSIMD &w)
MFEM_ALWAYS_INLINE AutoSIMD operator*(const double &e) const
MFEM_ALWAYS_INLINE AutoSIMD operator*(const AutoSIMD &v) const
MFEM_ALWAYS_INLINE AutoSIMD & fma(const AutoSIMD &v, const double &e)
AutoSIMD(const AutoSIMD &)=default
MFEM_ALWAYS_INLINE double & operator[](int i)
MFEM_ALWAYS_INLINE AutoSIMD operator-(const double &e) const
MFEM_ALWAYS_INLINE const double & operator[](int i) const
MFEM_ALWAYS_INLINE AutoSIMD operator-(const AutoSIMD &v) const
MFEM_ALWAYS_INLINE AutoSIMD & operator=(const AutoSIMD &v)
MFEM_ALWAYS_INLINE AutoSIMD & fma(const double &e, const AutoSIMD &v)
MFEM_ALWAYS_INLINE AutoSIMD operator-() const
MFEM_ALWAYS_INLINE AutoSIMD & operator/=(const double &e)
MFEM_ALWAYS_INLINE AutoSIMD operator+() const
MFEM_ALWAYS_INLINE AutoSIMD & mul(const AutoSIMD &v, const double &e)
MFEM_ALWAYS_INLINE AutoSIMD & operator=(const double &e)
MFEM_ALWAYS_INLINE AutoSIMD operator+(const double &e) const
MFEM_ALWAYS_INLINE AutoSIMD & operator+=(const double &e)
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 double &e) const
MFEM_ALWAYS_INLINE AutoSIMD & operator*=(const AutoSIMD &v)
MFEM_ALWAYS_INLINE AutoSIMD & operator*=(const double &e)
MFEM_ALWAYS_INLINE AutoSIMD & mul(const double &e, const AutoSIMD &v)
MFEM_ALWAYS_INLINE AutoSIMD & operator+=(const AutoSIMD &v)
static const int align_bytes