10 #ifndef EIGEN_COMPLEX_AVX_H 11 #define EIGEN_COMPLEX_AVX_H 58 const __m256 mask = _mm256_castsi256_ps(_mm256_setr_epi32(0x00000000,0x80000000,0x00000000,0x80000000,0x00000000,0x80000000,0x00000000,0x80000000));
64 __m256 tmp1 = _mm256_mul_ps(_mm256_moveldup_ps(a.v),
b.v);
65 __m256 tmp2 = _mm256_mul_ps(_mm256_movehdup_ps(a.v), _mm256_permute_ps(
b.v, _MM_SHUFFLE(2,3,0,1)));
66 __m256 result = _mm256_addsub_ps(tmp1, tmp2);
81 return Packet4cf(_mm256_castpd_ps(_mm256_broadcast_sd((
const double*)(
const void*)&from)));
89 return Packet4cf(_mm256_insertf128_ps(_mm256_castps128_ps256(a.
v), b.v, 1));
95 template<> EIGEN_DEVICE_FUNC
inline Packet4cf pgather<std::complex<float>,
Packet4cf>(
const std::complex<float>* from,
Index stride)
103 template<> EIGEN_DEVICE_FUNC
inline void pscatter<std::complex<float>,
Packet4cf>(std::complex<float>* to,
const Packet4cf& from,
Index stride)
105 __m128 low = _mm256_extractf128_ps(from.v, 0);
106 to[stride*0] = std::complex<float>(_mm_cvtss_f32(_mm_shuffle_ps(low, low, 0)),
107 _mm_cvtss_f32(_mm_shuffle_ps(low, low, 1)));
108 to[stride*1] = std::complex<float>(_mm_cvtss_f32(_mm_shuffle_ps(low, low, 2)),
109 _mm_cvtss_f32(_mm_shuffle_ps(low, low, 3)));
111 __m128 high = _mm256_extractf128_ps(from.v, 1);
112 to[stride*2] = std::complex<float>(_mm_cvtss_f32(_mm_shuffle_ps(high, high, 0)),
113 _mm_cvtss_f32(_mm_shuffle_ps(high, high, 1)));
114 to[stride*3] = std::complex<float>(_mm_cvtss_f32(_mm_shuffle_ps(high, high, 2)),
115 _mm_cvtss_f32(_mm_shuffle_ps(high, high, 3)));
125 __m128 low = _mm256_extractf128_ps(a.
v, 0);
126 __m128 high = _mm256_extractf128_ps(a.
v, 1);
127 __m128d lowd = _mm_castps_pd(low);
128 __m128d highd = _mm_castps_pd(high);
129 low = _mm_castpd_ps(_mm_shuffle_pd(lowd,lowd,0x1));
130 high = _mm_castpd_ps(_mm_shuffle_pd(highd,highd,0x1));
131 __m256 result = _mm256_setzero_ps();
132 result = _mm256_insertf128_ps(result, low, 1);
133 result = _mm256_insertf128_ps(result, high, 0);
140 Packet2cf(_mm256_extractf128_ps(a.v,1))));
145 Packet8f t0 = _mm256_shuffle_ps(vecs[0].
v, vecs[0].v, _MM_SHUFFLE(3, 1, 2 ,0));
146 Packet8f t1 = _mm256_shuffle_ps(vecs[1].v, vecs[1].v, _MM_SHUFFLE(3, 1, 2 ,0));
147 t0 = _mm256_hadd_ps(t0,t1);
148 Packet8f t2 = _mm256_shuffle_ps(vecs[2].v, vecs[2].v, _MM_SHUFFLE(3, 1, 2 ,0));
149 Packet8f t3 = _mm256_shuffle_ps(vecs[3].v, vecs[3].v, _MM_SHUFFLE(3, 1, 2 ,0));
150 t2 = _mm256_hadd_ps(t2,t3);
152 t1 = _mm256_permute2f128_ps(t0,t2, 0 + (2<<4));
153 t3 = _mm256_permute2f128_ps(t0,t2, 1 + (3<<4));
161 Packet2cf(_mm256_extractf128_ps(a.v, 1))));
169 if (Offset==0)
return;
228 __m256 tmp = _mm256_mul_ps(
b.v,
b.v);
229 __m256 tmp2 = _mm256_shuffle_ps(tmp,tmp,0xB1);
230 __m256 denom = _mm256_add_ps(tmp, tmp2);
231 return Packet4cf(_mm256_div_ps(num.
v, denom));
236 return Packet4cf(_mm256_shuffle_ps(x.v, x.v, _MM_SHUFFLE(2, 3, 0 ,1)));
277 const __m256d mask = _mm256_castsi256_pd(_mm256_set_epi32(0x80000000,0x0,0x0,0x0,0x80000000,0x0,0x0,0x0));
283 __m256d tmp1 = _mm256_shuffle_pd(a.v,a.v,0x0);
284 __m256d even = _mm256_mul_pd(tmp1,
b.v);
285 __m256d tmp2 = _mm256_shuffle_pd(a.v,a.v,0xF);
286 __m256d tmp3 = _mm256_shuffle_pd(
b.v,
b.v,0x5);
287 __m256d odd = _mm256_mul_pd(tmp2, tmp3);
288 return Packet2cd(_mm256_addsub_pd(even, odd));
305 return Packet2cd(_mm256_broadcast_pd((
const __m128d*)(
const void*)&from));
313 template<> EIGEN_DEVICE_FUNC
inline Packet2cd pgather<std::complex<double>,
Packet2cd>(
const std::complex<double>* from,
Index stride)
319 template<> EIGEN_DEVICE_FUNC
inline void pscatter<std::complex<double>,
Packet2cd>(std::complex<double>* to,
const Packet2cd& from,
Index stride)
321 __m128d low = _mm256_extractf128_pd(from.v, 0);
322 to[stride*0] = std::complex<double>(_mm_cvtsd_f64(low), _mm_cvtsd_f64(_mm_shuffle_pd(low, low, 1)));
323 __m128d high = _mm256_extractf128_pd(from.v, 1);
324 to[stride*1] = std::complex<double>(_mm_cvtsd_f64(high), _mm_cvtsd_f64(_mm_shuffle_pd(high, high, 1)));
329 __m128d low = _mm256_extractf128_pd(a.v, 0);
331 _mm_store_pd(res, low);
332 return std::complex<double>(res[0],res[1]);
336 __m256d result = _mm256_permute2f128_pd(a.
v, a.
v, 1);
343 Packet1cd(_mm256_extractf128_pd(a.v,1))));
348 Packet4d t0 = _mm256_permute2f128_pd(vecs[0].
v,vecs[1].v, 0 + (2<<4));
349 Packet4d t1 = _mm256_permute2f128_pd(vecs[0].v,vecs[1].v, 1 + (3<<4));
357 Packet1cd(_mm256_extractf128_pd(a.v,1))));
365 if (Offset==0)
return;
424 __m256d tmp = _mm256_mul_pd(
b.v,
b.v);
425 __m256d denom = _mm256_hadd_pd(tmp, tmp);
426 return Packet2cd(_mm256_div_pd(num.
v, denom));
431 return Packet2cd(_mm256_shuffle_pd(x.v, x.v, 0x5));
434 EIGEN_DEVICE_FUNC
inline void 436 __m256d P0 = _mm256_castps_pd(kernel.
packet[0].v);
437 __m256d P1 = _mm256_castps_pd(kernel.
packet[1].v);
438 __m256d P2 = _mm256_castps_pd(kernel.
packet[2].v);
439 __m256d P3 = _mm256_castps_pd(kernel.
packet[3].v);
441 __m256d T0 = _mm256_shuffle_pd(P0, P1, 15);
442 __m256d T1 = _mm256_shuffle_pd(P0, P1, 0);
443 __m256d T2 = _mm256_shuffle_pd(P2, P3, 15);
444 __m256d T3 = _mm256_shuffle_pd(P2, P3, 0);
446 kernel.
packet[1].v = _mm256_castpd_ps(_mm256_permute2f128_pd(T0, T2, 32));
447 kernel.
packet[3].v = _mm256_castpd_ps(_mm256_permute2f128_pd(T0, T2, 49));
448 kernel.
packet[0].v = _mm256_castpd_ps(_mm256_permute2f128_pd(T1, T3, 32));
449 kernel.
packet[2].v = _mm256_castpd_ps(_mm256_permute2f128_pd(T1, T3, 49));
452 EIGEN_DEVICE_FUNC
inline void 454 __m256d tmp = _mm256_permute2f128_pd(kernel.
packet[0].v, kernel.
packet[1].v, 0+(2<<4));
455 kernel.
packet[1].v = _mm256_permute2f128_pd(kernel.
packet[0].v, kernel.
packet[1].v, 1+(3<<4));
483 #endif // EIGEN_COMPLEX_AVX_H EIGEN_STRONG_INLINE std::complex< double > pfirst< Packet2cd >(const Packet2cd &a)
EIGEN_STRONG_INLINE Packet4cf pmul< Packet4cf >(const Packet4cf &a, const Packet4cf &b)
EIGEN_STRONG_INLINE Packet2cd pxor< Packet2cd >(const Packet2cd &a, const Packet2cd &b)
EIGEN_STRONG_INLINE Packet4cf pxor< Packet4cf >(const Packet4cf &a, const Packet4cf &b)
#define EIGEN_STRONG_INLINE
EIGEN_STRONG_INLINE std::complex< double > predux< Packet2cd >(const Packet2cd &a)
EIGEN_STRONG_INLINE Packet2cd pcplxflip< Packet2cd >(const Packet2cd &x)
EIGEN_DEVICE_FUNC RealReturnType real() const
EIGEN_STRONG_INLINE Packet2cd pmadd(const Packet2cd &x, const Packet2cd &y, const Packet2cd &c) const
EIGEN_STRONG_INLINE Packet4cf pmadd(const Packet4cf &x, const Packet4cf &y, const Packet4cf &c) const
EIGEN_STRONG_INLINE Packet4cf pinsertfirst(const Packet4cf &a, std::complex< float > b)
#define EIGEN_DEBUG_UNALIGNED_LOAD
EIGEN_STRONG_INLINE Packet2cd ploaddup< Packet2cd >(const std::complex< double > *from)
EIGEN_STRONG_INLINE Packet2cd pmadd(const Packet2cd &x, const Packet4d &y, const Packet2cd &c) const
EIGEN_STRONG_INLINE Packet4cf pand< Packet4cf >(const Packet4cf &a, const Packet4cf &b)
EIGEN_STRONG_INLINE Packet4cf pload< Packet4cf >(const std::complex< float > *from)
EIGEN_STRONG_INLINE Packet4cf pmul(const Packet4cf &a, const Packet4cf &b) const
std::complex< float > type
EIGEN_STRONG_INLINE Packet4cf pmadd(const Packet4cf &x, const Packet8f &y, const Packet4cf &c) const
EIGEN_STRONG_INLINE Packet4cf pmul(const Packet4cf &a, const Packet4cf &b) const
#define EIGEN_DEBUG_ALIGNED_STORE
EIGEN_STRONG_INLINE Packet4cf ploadu< Packet4cf >(const std::complex< float > *from)
static constexpr size_t size(Tuple< Args... > &)
Provides access to the number of elements in a tuple as a compile-time constant expression.
EIGEN_STRONG_INLINE Packet2cd pmadd(const Packet2cd &x, const Packet2cd &y, const Packet2cd &c) const
EIGEN_STRONG_INLINE Packet2cd pdiv< Packet2cd >(const Packet2cd &a, const Packet2cd &b)
EIGEN_DEVICE_FUNC unpacket_traits< Packet >::type predux(const Packet &a)
#define EIGEN_DEBUG_UNALIGNED_STORE
std::complex< double > type
EIGEN_STRONG_INLINE Packet2cd padd< Packet2cd >(const Packet2cd &a, const Packet2cd &b)
#define EIGEN_DEBUG_ALIGNED_LOAD
EIGEN_STRONG_INLINE Packet4d ploadu< Packet4d >(const double *from)
EIGEN_STRONG_INLINE Packet4cf ploaddup< Packet4cf >(const std::complex< float > *from)
EIGEN_STRONG_INLINE Packet2cd()
static EIGEN_STRONG_INLINE void run(Packet2cd &first, const Packet2cd &second)
EIGEN_STRONG_INLINE Packet4cf psub< Packet4cf >(const Packet4cf &a, const Packet4cf &b)
EIGEN_STRONG_INLINE Packet4cf pmul(const Packet4cf &a, const Packet4cf &b) const
EIGEN_DEVICE_FUNC Packet padd(const Packet &a, const Packet &b)
EIGEN_STRONG_INLINE Packet4cf preduxp< Packet4cf >(const Packet4cf *vecs)
EIGEN_STRONG_INLINE Packet4cf pmadd(const Packet8f &x, const Packet4cf &y, const Packet4cf &c) const
EIGEN_DEVICE_FUNC void pstoreu(Scalar *to, const Packet &from)
EIGEN_STRONG_INLINE Packet2cd por< Packet2cd >(const Packet2cd &a, const Packet2cd &b)
EIGEN_STRONG_INLINE Packet2cd pandnot< Packet2cd >(const Packet2cd &a, const Packet2cd &b)
EIGEN_STRONG_INLINE Packet2cd pload< Packet2cd >(const std::complex< double > *from)
EIGEN_STRONG_INLINE Packet2cd pmul(const Packet2cd &a, const Packet2cd &b) const
EIGEN_STRONG_INLINE Packet4cf pset1< Packet4cf >(const std::complex< float > &from)
EIGEN_STRONG_INLINE void ptranspose(PacketBlock< Packet2cf, 2 > &kernel)
EIGEN_STRONG_INLINE Packet2cd pmul(const Packet4d &x, const Packet2cd &y) const
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
EIGEN_STRONG_INLINE Packet4cf pmul(const Packet8f &x, const Packet4cf &y) const
EIGEN_DEVICE_FUNC unpacket_traits< Packet >::type pfirst(const Packet &a)
EIGEN_STRONG_INLINE Packet4d pload< Packet4d >(const double *from)
EIGEN_STRONG_INLINE Packet4cf pmul(const Packet4cf &x, const Packet8f &y) const
EIGEN_STRONG_INLINE Packet2cf pconj(const Packet2cf &a)
EIGEN_STRONG_INLINE Packet4cf pmadd(const Packet4cf &x, const Packet4cf &y, const Packet4cf &c) const
EIGEN_STRONG_INLINE Packet2cf ploaddup< Packet2cf >(const std::complex< float > *from)
EIGEN_STRONG_INLINE Packet4cf()
EIGEN_STRONG_INLINE Packet4cf por< Packet4cf >(const Packet4cf &a, const Packet4cf &b)
EIGEN_DEVICE_FUNC void pstore(Scalar *to, const Packet &from)
EIGEN_STRONG_INLINE Packet2cd(const __m256d &a)
EIGEN_STRONG_INLINE Packet2cd ploadu< Packet2cd >(const std::complex< double > *from)
EIGEN_STRONG_INLINE Packet2cd pmul(const Packet2cd &a, const Packet2cd &b) const
EIGEN_STRONG_INLINE Packet2cf pnegate(const Packet2cf &a)
EIGEN_STRONG_INLINE Packet2cd psub< Packet2cd >(const Packet2cd &a, const Packet2cd &b)
EIGEN_STRONG_INLINE Packet8f ploadu< Packet8f >(const float *from)
EIGEN_STRONG_INLINE std::complex< double > predux_mul< Packet2cd >(const Packet2cd &a)
EIGEN_DEVICE_FUNC unpacket_traits< Packet >::type predux_mul(const Packet &a)
EIGEN_STRONG_INLINE Packet4cf pandnot< Packet4cf >(const Packet4cf &a, const Packet4cf &b)
EIGEN_STRONG_INLINE Packet4cf pcplxflip< Packet4cf >(const Packet4cf &x)
EIGEN_STRONG_INLINE Packet4cf pdiv< Packet4cf >(const Packet4cf &a, const Packet4cf &b)
EIGEN_STRONG_INLINE Packet8f pload< Packet8f >(const float *from)
EIGEN_STRONG_INLINE Packet4cf pinsertlast(const Packet4cf &a, std::complex< float > b)
EIGEN_DEVICE_FUNC const ImagReturnType imag() const
EIGEN_STRONG_INLINE Packet2cd pmadd(const Packet2cd &x, const Packet2cd &y, const Packet2cd &c) const
EIGEN_STRONG_INLINE Packet2cd pmadd(const Packet4d &x, const Packet2cd &y, const Packet2cd &c) const
EIGEN_STRONG_INLINE Packet4cf pmadd(const Packet4cf &x, const Packet4cf &y, const Packet4cf &c) const
EIGEN_STRONG_INLINE Packet2cd pset1< Packet2cd >(const std::complex< double > &from)
EIGEN_STRONG_INLINE Packet2cd preduxp< Packet2cd >(const Packet2cd *vecs)
static void run(PacketType &, const PacketType &)
EIGEN_STRONG_INLINE Packet4cf(const __m256 &a)
static EIGEN_STRONG_INLINE void run(Packet4cf &first, const Packet4cf &second)
EIGEN_DEVICE_FUNC const Scalar & b
EIGEN_STRONG_INLINE std::complex< float > predux< Packet4cf >(const Packet4cf &a)
EIGEN_DEVICE_FUNC Packet pmul(const Packet &a, const Packet &b)
EIGEN_STRONG_INLINE std::complex< float > predux_mul< Packet4cf >(const Packet4cf &a)
EIGEN_STRONG_INLINE Packet2cd pmul(const Packet2cd &x, const Packet4d &y) const
EIGEN_STRONG_INLINE Packet4cf padd< Packet4cf >(const Packet4cf &a, const Packet4cf &b)
EIGEN_STRONG_INLINE Packet2cd pand< Packet2cd >(const Packet2cd &a, const Packet2cd &b)
EIGEN_STRONG_INLINE Packet2cd pmul(const Packet2cd &a, const Packet2cd &b) const
EIGEN_STRONG_INLINE Packet2cf preverse(const Packet2cf &a)
EIGEN_STRONG_INLINE Packet2cd pmul< Packet2cd >(const Packet2cd &a, const Packet2cd &b)
EIGEN_STRONG_INLINE std::complex< float > pfirst< Packet4cf >(const Packet4cf &a)