25 #ifndef EIGEN_COMPLEX_NEON_H
26 #define EIGEN_COMPLEX_NEON_H
43 template<>
struct packet_traits<std::complex<float> > : default_packet_traits
45 typedef Packet2cf type;
64 template<>
struct unpacket_traits<Packet2cf> {
typedef std::complex<float> type;
enum {size=2}; };
69 r64 = vld1_f32((
float *)&from);
71 return Packet2cf(vcombine_f32(r64, r64));
80 return Packet2cf(vreinterpretq_f32_u32(veorq_u32(b, p4ui_CONJ_XOR)));
86 float32x2_t a_lo, a_hi;
89 v1 = vcombine_f32(vdup_lane_f32(vget_low_f32(a.v), 0), vdup_lane_f32(vget_high_f32(a.v), 0));
91 v2 = vcombine_f32(vdup_lane_f32(vget_low_f32(a.v), 1), vdup_lane_f32(vget_high_f32(a.v), 1));
93 v1 = vmulq_f32(v1, b.v);
95 v2 = vmulq_f32(v2, b.v);
97 v2 = vreinterpretq_f32_u32(veorq_u32(vreinterpretq_u32_f32(v2), p4ui_CONJ_XOR));
99 a_lo = vrev64_f32(vget_low_f32(v2));
100 a_hi = vrev64_f32(vget_high_f32(v2));
101 v2 = vcombine_f32(a_lo, a_hi);
103 return Packet2cf(vaddq_f32(v1, v2));
108 return Packet2cf(vreinterpretq_f32_u32(vorrq_u32(vreinterpretq_u32_f32(a.v),vreinterpretq_u32_f32(b.v))));
112 return Packet2cf(vreinterpretq_f32_u32(vorrq_u32(vreinterpretq_u32_f32(a.v),vreinterpretq_u32_f32(b.v))));
116 return Packet2cf(vreinterpretq_f32_u32(veorq_u32(vreinterpretq_u32_f32(a.v),vreinterpretq_u32_f32(b.v))));
120 return Packet2cf(vreinterpretq_f32_u32(vbicq_u32(vreinterpretq_u32_f32(a.v),vreinterpretq_u32_f32(b.v))));
131 template<>
EIGEN_STRONG_INLINE void prefetch<std::complex<float> >(
const std::complex<float> * addr) {
__pld((
float *)addr); }
136 vst1q_f32((
float *)x, a.v);
142 float32x2_t a_lo, a_hi;
145 a_lo = vget_low_f32(a.v);
146 a_hi = vget_high_f32(a.v);
147 a_r128 = vcombine_f32(a_hi, a_lo);
149 return Packet2cf(a_r128);
154 return Packet2cf(vrev64q_f32(a.v));
160 std::complex<float> s;
162 a1 = vget_low_f32(a.v);
163 a2 = vget_high_f32(a.v);
164 a2 = vadd_f32(a1, a2);
165 vst1_f32((
float *)&s, a2);
175 sum1 = vcombine_f32(vget_low_f32(vecs[0].v), vget_low_f32(vecs[1].v));
176 sum2 = vcombine_f32(vget_high_f32(vecs[0].v), vget_high_f32(vecs[1].v));
177 sum = vaddq_f32(sum1, sum2);
179 return Packet2cf(sum);
184 float32x2_t a1, a2, v1, v2, prod;
185 std::complex<float> s;
187 a1 = vget_low_f32(a.v);
188 a2 = vget_high_f32(a.v);
190 v1 = vdup_lane_f32(a1, 0);
192 v2 = vdup_lane_f32(a1, 1);
194 v1 = vmul_f32(v1, a2);
196 v2 = vmul_f32(v2, a2);
198 v2 = vreinterpret_f32_u32(veor_u32(vreinterpret_u32_f32(v2), p2ui_CONJ_XOR));
202 prod = vadd_f32(v1, v2);
204 vst1_f32((
float *)&s, prod);
210 struct palign_impl<Offset,Packet2cf>
216 first.v = vextq_f32(first.v, second.v, 2);
221 template<>
struct conj_helper<Packet2cf, Packet2cf, false,true>
232 template<>
struct conj_helper<Packet2cf, Packet2cf, true,false>
243 template<>
struct conj_helper<Packet2cf, Packet2cf, true,true>
257 Packet2cf res = conj_helper<Packet2cf,Packet2cf,false,true>().
pmul(a,b);
259 float32x2_t a_lo, a_hi;
262 s = vmulq_f32(b.v, b.v);
263 a_lo = vrev64_f32(vget_low_f32(s));
264 a_hi = vrev64_f32(vget_high_f32(s));
265 rev_s = vcombine_f32(a_lo, a_hi);
267 return Packet2cf(
pdiv(res.v, vaddq_f32(s,rev_s)));
274 #endif // EIGEN_COMPLEX_NEON_H