From 38ae5353ab6f1050aed64821ac56a1561096cdce Mon Sep 17 00:00:00 2001 From: Guoqiang QI <425418567@qq.com> Date: Wed, 13 Jan 2021 22:54:03 +0000 Subject: 1)provide a better generic paddsub op implementation 2)make paddsub op support the Packet2cf/Packet4f/Packet2f in NEON 3)make paddsub op support the Packet2cf/Packet4f in SSE --- Eigen/src/Core/arch/SSE/Complex.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Eigen/src/Core/arch/SSE/Complex.h') diff --git a/Eigen/src/Core/arch/SSE/Complex.h b/Eigen/src/Core/arch/SSE/Complex.h index 58cdb5dbe..f6f1b8c9f 100644 --- a/Eigen/src/Core/arch/SSE/Complex.h +++ b/Eigen/src/Core/arch/SSE/Complex.h @@ -66,6 +66,13 @@ template<> struct unpacket_traits { template<> EIGEN_STRONG_INLINE Packet2cf padd(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(_mm_add_ps(a.v,b.v)); } template<> EIGEN_STRONG_INLINE Packet2cf psub(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(_mm_sub_ps(a.v,b.v)); } +template<> EIGEN_STRONG_INLINE Packet2cf pxor(const Packet2cf& a, const Packet2cf& b); +template<> EIGEN_STRONG_INLINE Packet2cf paddsub(const Packet2cf& a, const Packet2cf& b) +{ + const Packet4f mask = _mm_castsi128_ps(_mm_setr_epi32(0x80000000,0x80000000,0x0,0x0)); + return Packet2cf(padd(a.v, pxor(mask, b.v))); +} + template<> EIGEN_STRONG_INLINE Packet2cf pnegate(const Packet2cf& a) { const __m128 mask = _mm_castsi128_ps(_mm_setr_epi32(0x80000000,0x80000000,0x80000000,0x80000000)); -- cgit v1.2.3