12 #ifndef EIGEN_PACKET_MATH_NEON_H 13 #define EIGEN_PACKET_MATH_NEON_H 19 #ifndef EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD 20 #define EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD 8 23 #ifndef EIGEN_HAS_SINGLE_INSTRUCTION_MADD 24 #define EIGEN_HAS_SINGLE_INSTRUCTION_MADD 27 #ifndef EIGEN_HAS_SINGLE_INSTRUCTION_CJMADD 28 #define EIGEN_HAS_SINGLE_INSTRUCTION_CJMADD 31 #ifndef EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS 33 #define EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS 32 35 #define EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS 16 39 typedef float32x2_t Packet2f;
40 typedef float32x4_t Packet4f;
41 typedef int32x4_t Packet4i;
42 typedef int32x2_t Packet2i;
43 typedef uint32x4_t Packet4ui;
45 #define _EIGEN_DECLARE_CONST_Packet4f(NAME,X) \ 46 const Packet4f p4f_##NAME = pset1<Packet4f>(X) 48 #define _EIGEN_DECLARE_CONST_Packet4f_FROM_INT(NAME,X) \ 49 const Packet4f p4f_##NAME = vreinterpretq_f32_u32(pset1<int32_t>(X)) 51 #define _EIGEN_DECLARE_CONST_Packet4i(NAME,X) \ 52 const Packet4i p4i_##NAME = pset1<Packet4i>(X) 58 #define EIGEN_ARM_PREFETCH(ADDR) __asm__ __volatile__("prfm pldl1keep, [%[addr]]\n" ::[addr] "r"(ADDR) : ); 59 #elif EIGEN_HAS_BUILTIN(__builtin_prefetch) || EIGEN_COMP_GNUC 60 #define EIGEN_ARM_PREFETCH(ADDR) __builtin_prefetch(ADDR); 62 #define EIGEN_ARM_PREFETCH(ADDR) __pld(ADDR) 63 #elif EIGEN_ARCH_ARM32 64 #define EIGEN_ARM_PREFETCH(ADDR) __asm__ __volatile__ ("pld [%[addr]]\n" :: [addr] "r" (ADDR) : ); 67 #define EIGEN_ARM_PREFETCH(ADDR) 70 template<>
struct packet_traits<float> : default_packet_traits
72 typedef Packet4f type;
73 typedef Packet4f half;
89 template<>
struct packet_traits<int32_t> : default_packet_traits
91 typedef Packet4i type;
92 typedef Packet4i half;
102 #if EIGEN_GNUC_AT_MOST(4,4) && !EIGEN_COMP_LLVM 104 EIGEN_STRONG_INLINE float32x4_t vld1q_f32(
const float* x) { return ::vld1q_f32((
const float32_t*)x); }
105 EIGEN_STRONG_INLINE float32x2_t vld1_f32 (
const float* x) { return ::vld1_f32 ((
const float32_t*)x); }
106 EIGEN_STRONG_INLINE float32x2_t vld1_dup_f32 (
const float* x) { return ::vld1_dup_f32 ((
const float32_t*)x); }
107 EIGEN_STRONG_INLINE
void vst1q_f32(
float* to, float32x4_t from) { ::vst1q_f32((float32_t*)to,from); }
108 EIGEN_STRONG_INLINE
void vst1_f32 (
float* to, float32x2_t from) { ::vst1_f32 ((float32_t*)to,from); }
111 template<>
struct unpacket_traits<Packet4f> {
typedef float type;
enum {size=4, alignment=
Aligned16};
typedef Packet4f half; };
112 template<>
struct unpacket_traits<Packet4i> {
typedef int32_t type;
enum {size=4, alignment=
Aligned16};
typedef Packet4i half; };
114 template<> EIGEN_STRONG_INLINE Packet4f pset1<Packet4f>(
const float& from) {
return vdupq_n_f32(from); }
115 template<> EIGEN_STRONG_INLINE Packet4i pset1<Packet4i>(
const int32_t& from) {
return vdupq_n_s32(from); }
117 template<> EIGEN_STRONG_INLINE Packet4f plset<Packet4f>(
const float& a)
119 const float f[] = {0, 1, 2, 3};
120 Packet4f countdown = vld1q_f32(f);
121 return vaddq_f32(pset1<Packet4f>(a), countdown);
123 template<> EIGEN_STRONG_INLINE Packet4i plset<Packet4i>(
const int32_t& a)
125 const int32_t i[] = {0, 1, 2, 3};
126 Packet4i countdown = vld1q_s32(i);
127 return vaddq_s32(pset1<Packet4i>(a), countdown);
130 template<> EIGEN_STRONG_INLINE Packet4f padd<Packet4f>(
const Packet4f& a,
const Packet4f& b) {
return vaddq_f32(a,b); }
131 template<> EIGEN_STRONG_INLINE Packet4i padd<Packet4i>(
const Packet4i& a,
const Packet4i& b) {
return vaddq_s32(a,b); }
133 template<> EIGEN_STRONG_INLINE Packet4f psub<Packet4f>(
const Packet4f& a,
const Packet4f& b) {
return vsubq_f32(a,b); }
134 template<> EIGEN_STRONG_INLINE Packet4i psub<Packet4i>(
const Packet4i& a,
const Packet4i& b) {
return vsubq_s32(a,b); }
136 template<> EIGEN_STRONG_INLINE Packet4f pnegate(
const Packet4f& a) {
return vnegq_f32(a); }
137 template<> EIGEN_STRONG_INLINE Packet4i pnegate(
const Packet4i& a) {
return vnegq_s32(a); }
139 template<> EIGEN_STRONG_INLINE Packet4f pconj(
const Packet4f& a) {
return a; }
140 template<> EIGEN_STRONG_INLINE Packet4i pconj(
const Packet4i& a) {
return a; }
142 template<> EIGEN_STRONG_INLINE Packet4f pmul<Packet4f>(
const Packet4f& a,
const Packet4f& b) {
return vmulq_f32(a,b); }
143 template<> EIGEN_STRONG_INLINE Packet4i pmul<Packet4i>(
const Packet4i& a,
const Packet4i& b) {
return vmulq_s32(a,b); }
145 template<> EIGEN_STRONG_INLINE Packet4f pdiv<Packet4f>(
const Packet4f& a,
const Packet4f& b)
148 return vdivq_f32(a,b);
150 Packet4f inv, restep, div;
157 inv = vrecpeq_f32(b);
161 restep = vrecpsq_f32(b, inv);
162 inv = vmulq_f32(restep, inv);
165 div = vmulq_f32(a, inv);
171 template<> EIGEN_STRONG_INLINE Packet4i pdiv<Packet4i>(
const Packet4i& ,
const Packet4i& )
172 { eigen_assert(
false &&
"packet integer division are not supported by NEON");
173 return pset1<Packet4i>(0);
180 #if (defined __ARM_FEATURE_FMA) && !(EIGEN_COMP_CLANG && EIGEN_ARCH_ARM) 187 template<> EIGEN_STRONG_INLINE Packet4f pmadd(
const Packet4f& a,
const Packet4f& b,
const Packet4f& c) {
return vfmaq_f32(c,a,b); }
189 template<> EIGEN_STRONG_INLINE Packet4f pmadd(
const Packet4f& a,
const Packet4f& b,
const Packet4f& c) {
190 #if EIGEN_COMP_CLANG && EIGEN_ARCH_ARM 200 "vmla.f32 %q[r], %q[a], %q[b]" 207 return vmlaq_f32(c,a,b);
213 template<> EIGEN_STRONG_INLINE Packet4i pmadd(
const Packet4i& a,
const Packet4i& b,
const Packet4i& c) {
return vmlaq_s32(c,a,b); }
215 template<> EIGEN_STRONG_INLINE Packet4f pmin<Packet4f>(
const Packet4f& a,
const Packet4f& b) {
return vminq_f32(a,b); }
216 template<> EIGEN_STRONG_INLINE Packet4i pmin<Packet4i>(
const Packet4i& a,
const Packet4i& b) {
return vminq_s32(a,b); }
218 template<> EIGEN_STRONG_INLINE Packet4f pmax<Packet4f>(
const Packet4f& a,
const Packet4f& b) {
return vmaxq_f32(a,b); }
219 template<> EIGEN_STRONG_INLINE Packet4i pmax<Packet4i>(
const Packet4i& a,
const Packet4i& b) {
return vmaxq_s32(a,b); }
222 template<> EIGEN_STRONG_INLINE Packet4f pand<Packet4f>(
const Packet4f& a,
const Packet4f& b)
224 return vreinterpretq_f32_u32(vandq_u32(vreinterpretq_u32_f32(a),vreinterpretq_u32_f32(b)));
226 template<> EIGEN_STRONG_INLINE Packet4i pand<Packet4i>(
const Packet4i& a,
const Packet4i& b) {
return vandq_s32(a,b); }
228 template<> EIGEN_STRONG_INLINE Packet4f por<Packet4f>(
const Packet4f& a,
const Packet4f& b)
230 return vreinterpretq_f32_u32(vorrq_u32(vreinterpretq_u32_f32(a),vreinterpretq_u32_f32(b)));
232 template<> EIGEN_STRONG_INLINE Packet4i por<Packet4i>(
const Packet4i& a,
const Packet4i& b) {
return vorrq_s32(a,b); }
234 template<> EIGEN_STRONG_INLINE Packet4f pxor<Packet4f>(
const Packet4f& a,
const Packet4f& b)
236 return vreinterpretq_f32_u32(veorq_u32(vreinterpretq_u32_f32(a),vreinterpretq_u32_f32(b)));
238 template<> EIGEN_STRONG_INLINE Packet4i pxor<Packet4i>(
const Packet4i& a,
const Packet4i& b) {
return veorq_s32(a,b); }
240 template<> EIGEN_STRONG_INLINE Packet4f pandnot<Packet4f>(
const Packet4f& a,
const Packet4f& b)
242 return vreinterpretq_f32_u32(vbicq_u32(vreinterpretq_u32_f32(a),vreinterpretq_u32_f32(b)));
244 template<> EIGEN_STRONG_INLINE Packet4i pandnot<Packet4i>(
const Packet4i& a,
const Packet4i& b) {
return vbicq_s32(a,b); }
246 template<> EIGEN_STRONG_INLINE Packet4f pload<Packet4f>(
const float* from) { EIGEN_DEBUG_ALIGNED_LOAD
return vld1q_f32(from); }
247 template<> EIGEN_STRONG_INLINE Packet4i pload<Packet4i>(
const int32_t* from) { EIGEN_DEBUG_ALIGNED_LOAD
return vld1q_s32(from); }
249 template<> EIGEN_STRONG_INLINE Packet4f ploadu<Packet4f>(
const float* from) { EIGEN_DEBUG_UNALIGNED_LOAD
return vld1q_f32(from); }
250 template<> EIGEN_STRONG_INLINE Packet4i ploadu<Packet4i>(
const int32_t* from) { EIGEN_DEBUG_UNALIGNED_LOAD
return vld1q_s32(from); }
252 template<> EIGEN_STRONG_INLINE Packet4f ploaddup<Packet4f>(
const float* from)
255 lo = vld1_dup_f32(from);
256 hi = vld1_dup_f32(from+1);
257 return vcombine_f32(lo, hi);
259 template<> EIGEN_STRONG_INLINE Packet4i ploaddup<Packet4i>(
const int32_t* from)
262 lo = vld1_dup_s32(from);
263 hi = vld1_dup_s32(from+1);
264 return vcombine_s32(lo, hi);
267 template<> EIGEN_STRONG_INLINE
void pstore<float> (
float* to,
const Packet4f& from) { EIGEN_DEBUG_ALIGNED_STORE vst1q_f32(to, from); }
268 template<> EIGEN_STRONG_INLINE
void pstore<int32_t>(int32_t* to,
const Packet4i& from) { EIGEN_DEBUG_ALIGNED_STORE vst1q_s32(to, from); }
270 template<> EIGEN_STRONG_INLINE
void pstoreu<float> (
float* to,
const Packet4f& from) { EIGEN_DEBUG_UNALIGNED_STORE vst1q_f32(to, from); }
271 template<> EIGEN_STRONG_INLINE
void pstoreu<int32_t>(int32_t* to,
const Packet4i& from) { EIGEN_DEBUG_UNALIGNED_STORE vst1q_s32(to, from); }
273 template<> EIGEN_DEVICE_FUNC
inline Packet4f pgather<float, Packet4f>(
const float* from,
Index stride)
275 Packet4f res = pset1<Packet4f>(0.f);
276 res = vsetq_lane_f32(from[0*stride], res, 0);
277 res = vsetq_lane_f32(from[1*stride], res, 1);
278 res = vsetq_lane_f32(from[2*stride], res, 2);
279 res = vsetq_lane_f32(from[3*stride], res, 3);
282 template<> EIGEN_DEVICE_FUNC
inline Packet4i pgather<int32_t, Packet4i>(
const int32_t* from,
Index stride)
284 Packet4i res = pset1<Packet4i>(0);
285 res = vsetq_lane_s32(from[0*stride], res, 0);
286 res = vsetq_lane_s32(from[1*stride], res, 1);
287 res = vsetq_lane_s32(from[2*stride], res, 2);
288 res = vsetq_lane_s32(from[3*stride], res, 3);
292 template<> EIGEN_DEVICE_FUNC
inline void pscatter<float, Packet4f>(
float* to,
const Packet4f& from,
Index stride)
294 to[stride*0] = vgetq_lane_f32(from, 0);
295 to[stride*1] = vgetq_lane_f32(from, 1);
296 to[stride*2] = vgetq_lane_f32(from, 2);
297 to[stride*3] = vgetq_lane_f32(from, 3);
299 template<> EIGEN_DEVICE_FUNC
inline void pscatter<int32_t, Packet4i>(int32_t* to,
const Packet4i& from,
Index stride)
301 to[stride*0] = vgetq_lane_s32(from, 0);
302 to[stride*1] = vgetq_lane_s32(from, 1);
303 to[stride*2] = vgetq_lane_s32(from, 2);
304 to[stride*3] = vgetq_lane_s32(from, 3);
307 template<> EIGEN_STRONG_INLINE
void prefetch<float> (
const float* addr) { EIGEN_ARM_PREFETCH(addr); }
308 template<> EIGEN_STRONG_INLINE
void prefetch<int32_t>(
const int32_t* addr) { EIGEN_ARM_PREFETCH(addr); }
311 template<> EIGEN_STRONG_INLINE
float pfirst<Packet4f>(
const Packet4f& a) {
float EIGEN_ALIGN16 x[4]; vst1q_f32(x, a);
return x[0]; }
312 template<> EIGEN_STRONG_INLINE int32_t pfirst<Packet4i>(
const Packet4i& a) { int32_t EIGEN_ALIGN16 x[4]; vst1q_s32(x, a);
return x[0]; }
314 template<> EIGEN_STRONG_INLINE Packet4f preverse(
const Packet4f& a) {
315 float32x2_t a_lo, a_hi;
318 a_r64 = vrev64q_f32(a);
319 a_lo = vget_low_f32(a_r64);
320 a_hi = vget_high_f32(a_r64);
321 return vcombine_f32(a_hi, a_lo);
323 template<> EIGEN_STRONG_INLINE Packet4i preverse(
const Packet4i& a) {
324 int32x2_t a_lo, a_hi;
327 a_r64 = vrev64q_s32(a);
328 a_lo = vget_low_s32(a_r64);
329 a_hi = vget_high_s32(a_r64);
330 return vcombine_s32(a_hi, a_lo);
333 template<> EIGEN_STRONG_INLINE Packet4f pabs(
const Packet4f& a) {
return vabsq_f32(a); }
334 template<> EIGEN_STRONG_INLINE Packet4i pabs(
const Packet4i& a) {
return vabsq_s32(a); }
336 template<> EIGEN_STRONG_INLINE
float predux<Packet4f>(
const Packet4f& a)
338 float32x2_t a_lo, a_hi, sum;
340 a_lo = vget_low_f32(a);
341 a_hi = vget_high_f32(a);
342 sum = vpadd_f32(a_lo, a_hi);
343 sum = vpadd_f32(sum, sum);
344 return vget_lane_f32(sum, 0);
347 template<> EIGEN_STRONG_INLINE Packet4f preduxp<Packet4f>(
const Packet4f* vecs)
349 float32x4x2_t vtrn1, vtrn2, res1, res2;
350 Packet4f sum1, sum2, sum;
354 vtrn1 = vzipq_f32(vecs[0], vecs[2]);
355 vtrn2 = vzipq_f32(vecs[1], vecs[3]);
356 res1 = vzipq_f32(vtrn1.val[0], vtrn2.val[0]);
357 res2 = vzipq_f32(vtrn1.val[1], vtrn2.val[1]);
360 sum1 = vaddq_f32(res1.val[0], res1.val[1]);
361 sum2 = vaddq_f32(res2.val[0], res2.val[1]);
362 sum = vaddq_f32(sum1, sum2);
367 template<> EIGEN_STRONG_INLINE int32_t predux<Packet4i>(
const Packet4i& a)
369 int32x2_t a_lo, a_hi, sum;
371 a_lo = vget_low_s32(a);
372 a_hi = vget_high_s32(a);
373 sum = vpadd_s32(a_lo, a_hi);
374 sum = vpadd_s32(sum, sum);
375 return vget_lane_s32(sum, 0);
378 template<> EIGEN_STRONG_INLINE Packet4i preduxp<Packet4i>(
const Packet4i* vecs)
380 int32x4x2_t vtrn1, vtrn2, res1, res2;
381 Packet4i sum1, sum2, sum;
385 vtrn1 = vzipq_s32(vecs[0], vecs[2]);
386 vtrn2 = vzipq_s32(vecs[1], vecs[3]);
387 res1 = vzipq_s32(vtrn1.val[0], vtrn2.val[0]);
388 res2 = vzipq_s32(vtrn1.val[1], vtrn2.val[1]);
391 sum1 = vaddq_s32(res1.val[0], res1.val[1]);
392 sum2 = vaddq_s32(res2.val[0], res2.val[1]);
393 sum = vaddq_s32(sum1, sum2);
400 template<> EIGEN_STRONG_INLINE
float predux_mul<Packet4f>(
const Packet4f& a)
402 float32x2_t a_lo, a_hi, prod;
405 a_lo = vget_low_f32(a);
406 a_hi = vget_high_f32(a);
408 prod = vmul_f32(a_lo, a_hi);
410 prod = vmul_f32(prod, vrev64_f32(prod));
412 return vget_lane_f32(prod, 0);
414 template<> EIGEN_STRONG_INLINE int32_t predux_mul<Packet4i>(
const Packet4i& a)
416 int32x2_t a_lo, a_hi, prod;
419 a_lo = vget_low_s32(a);
420 a_hi = vget_high_s32(a);
422 prod = vmul_s32(a_lo, a_hi);
424 prod = vmul_s32(prod, vrev64_s32(prod));
426 return vget_lane_s32(prod, 0);
430 template<> EIGEN_STRONG_INLINE
float predux_min<Packet4f>(
const Packet4f& a)
432 float32x2_t a_lo, a_hi, min;
434 a_lo = vget_low_f32(a);
435 a_hi = vget_high_f32(a);
436 min = vpmin_f32(a_lo, a_hi);
437 min = vpmin_f32(min, min);
439 return vget_lane_f32(min, 0);
442 template<> EIGEN_STRONG_INLINE int32_t predux_min<Packet4i>(
const Packet4i& a)
444 int32x2_t a_lo, a_hi, min;
446 a_lo = vget_low_s32(a);
447 a_hi = vget_high_s32(a);
448 min = vpmin_s32(a_lo, a_hi);
449 min = vpmin_s32(min, min);
451 return vget_lane_s32(min, 0);
455 template<> EIGEN_STRONG_INLINE
float predux_max<Packet4f>(
const Packet4f& a)
457 float32x2_t a_lo, a_hi, max;
459 a_lo = vget_low_f32(a);
460 a_hi = vget_high_f32(a);
461 max = vpmax_f32(a_lo, a_hi);
462 max = vpmax_f32(max, max);
464 return vget_lane_f32(max, 0);
467 template<> EIGEN_STRONG_INLINE int32_t predux_max<Packet4i>(
const Packet4i& a)
469 int32x2_t a_lo, a_hi, max;
471 a_lo = vget_low_s32(a);
472 a_hi = vget_high_s32(a);
473 max = vpmax_s32(a_lo, a_hi);
474 max = vpmax_s32(max, max);
476 return vget_lane_s32(max, 0);
481 #define PALIGN_NEON(Offset,Type,Command) \ 483 struct palign_impl<Offset,Type>\ 485 EIGEN_STRONG_INLINE static void run(Type& first, const Type& second)\ 488 first = Command(first, second, Offset);\ 492 PALIGN_NEON(0,Packet4f,vextq_f32)
493 PALIGN_NEON(1,Packet4f,vextq_f32)
494 PALIGN_NEON(2,Packet4f,vextq_f32)
495 PALIGN_NEON(3,Packet4f,vextq_f32)
496 PALIGN_NEON(0,Packet4i,vextq_s32)
497 PALIGN_NEON(1,Packet4i,vextq_s32)
498 PALIGN_NEON(2,Packet4i,vextq_s32)
499 PALIGN_NEON(3,Packet4i,vextq_s32)
503 EIGEN_DEVICE_FUNC
inline void 504 ptranspose(PacketBlock<Packet4f,4>& kernel) {
505 float32x4x2_t tmp1 = vzipq_f32(kernel.packet[0], kernel.packet[1]);
506 float32x4x2_t tmp2 = vzipq_f32(kernel.packet[2], kernel.packet[3]);
508 kernel.packet[0] = vcombine_f32(vget_low_f32(tmp1.val[0]), vget_low_f32(tmp2.val[0]));
509 kernel.packet[1] = vcombine_f32(vget_high_f32(tmp1.val[0]), vget_high_f32(tmp2.val[0]));
510 kernel.packet[2] = vcombine_f32(vget_low_f32(tmp1.val[1]), vget_low_f32(tmp2.val[1]));
511 kernel.packet[3] = vcombine_f32(vget_high_f32(tmp1.val[1]), vget_high_f32(tmp2.val[1]));
514 EIGEN_DEVICE_FUNC
inline void 515 ptranspose(PacketBlock<Packet4i,4>& kernel) {
516 int32x4x2_t tmp1 = vzipq_s32(kernel.packet[0], kernel.packet[1]);
517 int32x4x2_t tmp2 = vzipq_s32(kernel.packet[2], kernel.packet[3]);
518 kernel.packet[0] = vcombine_s32(vget_low_s32(tmp1.val[0]), vget_low_s32(tmp2.val[0]));
519 kernel.packet[1] = vcombine_s32(vget_high_s32(tmp1.val[0]), vget_high_s32(tmp2.val[0]));
520 kernel.packet[2] = vcombine_s32(vget_low_s32(tmp1.val[1]), vget_low_s32(tmp2.val[1]));
521 kernel.packet[3] = vcombine_s32(vget_high_s32(tmp1.val[1]), vget_high_s32(tmp2.val[1]));
528 #ifdef __apple_build_version__ 532 #define EIGEN_APPLE_DOUBLE_NEON_BUG (__apple_build_version__ < 6010000) 534 #define EIGEN_APPLE_DOUBLE_NEON_BUG 0 537 #if EIGEN_ARCH_ARM64 && !EIGEN_APPLE_DOUBLE_NEON_BUG 543 template <
typename T>
544 uint64x2_t vreinterpretq_u64_f64(T a)
546 return (uint64x2_t) a;
549 template <
typename T>
550 float64x2_t vreinterpretq_f64_u64(T a)
552 return (float64x2_t) a;
555 typedef float64x2_t Packet2d;
556 typedef float64x1_t Packet1d;
558 template<>
struct packet_traits<double> : default_packet_traits
560 typedef Packet2d type;
561 typedef Packet2d half;
578 template<>
struct unpacket_traits<Packet2d> {
typedef double type;
enum {size=2, alignment=
Aligned16};
typedef Packet2d half; };
580 template<> EIGEN_STRONG_INLINE Packet2d pset1<Packet2d>(
const double& from) {
return vdupq_n_f64(from); }
582 template<> EIGEN_STRONG_INLINE Packet2d plset<Packet2d>(
const double& a)
584 const double countdown_raw[] = {0.0,1.0};
585 const Packet2d countdown = vld1q_f64(countdown_raw);
586 return vaddq_f64(pset1<Packet2d>(a), countdown);
588 template<> EIGEN_STRONG_INLINE Packet2d padd<Packet2d>(
const Packet2d& a,
const Packet2d& b) {
return vaddq_f64(a,b); }
590 template<> EIGEN_STRONG_INLINE Packet2d psub<Packet2d>(
const Packet2d& a,
const Packet2d& b) {
return vsubq_f64(a,b); }
592 template<> EIGEN_STRONG_INLINE Packet2d pnegate(
const Packet2d& a) {
return vnegq_f64(a); }
594 template<> EIGEN_STRONG_INLINE Packet2d pconj(
const Packet2d& a) {
return a; }
596 template<> EIGEN_STRONG_INLINE Packet2d pmul<Packet2d>(
const Packet2d& a,
const Packet2d& b) {
return vmulq_f64(a,b); }
598 template<> EIGEN_STRONG_INLINE Packet2d pdiv<Packet2d>(
const Packet2d& a,
const Packet2d& b) {
return vdivq_f64(a,b); }
600 #ifdef __ARM_FEATURE_FMA 602 template<> EIGEN_STRONG_INLINE Packet2d pmadd(
const Packet2d& a,
const Packet2d& b,
const Packet2d& c) {
return vfmaq_f64(c,a,b); }
604 template<> EIGEN_STRONG_INLINE Packet2d pmadd(
const Packet2d& a,
const Packet2d& b,
const Packet2d& c) {
return vmlaq_f64(c,a,b); }
607 template<> EIGEN_STRONG_INLINE Packet2d pmin<Packet2d>(
const Packet2d& a,
const Packet2d& b) {
return vminq_f64(a,b); }
609 template<> EIGEN_STRONG_INLINE Packet2d pmax<Packet2d>(
const Packet2d& a,
const Packet2d& b) {
return vmaxq_f64(a,b); }
612 template<> EIGEN_STRONG_INLINE Packet2d pand<Packet2d>(
const Packet2d& a,
const Packet2d& b)
614 return vreinterpretq_f64_u64(vandq_u64(vreinterpretq_u64_f64(a),vreinterpretq_u64_f64(b)));
617 template<> EIGEN_STRONG_INLINE Packet2d por<Packet2d>(
const Packet2d& a,
const Packet2d& b)
619 return vreinterpretq_f64_u64(vorrq_u64(vreinterpretq_u64_f64(a),vreinterpretq_u64_f64(b)));
622 template<> EIGEN_STRONG_INLINE Packet2d pxor<Packet2d>(
const Packet2d& a,
const Packet2d& b)
624 return vreinterpretq_f64_u64(veorq_u64(vreinterpretq_u64_f64(a),vreinterpretq_u64_f64(b)));
627 template<> EIGEN_STRONG_INLINE Packet2d pandnot<Packet2d>(
const Packet2d& a,
const Packet2d& b)
629 return vreinterpretq_f64_u64(vbicq_u64(vreinterpretq_u64_f64(a),vreinterpretq_u64_f64(b)));
632 template<> EIGEN_STRONG_INLINE Packet2d pload<Packet2d>(
const double* from) { EIGEN_DEBUG_ALIGNED_LOAD
return vld1q_f64(from); }
634 template<> EIGEN_STRONG_INLINE Packet2d ploadu<Packet2d>(
const double* from) { EIGEN_DEBUG_UNALIGNED_LOAD
return vld1q_f64(from); }
636 template<> EIGEN_STRONG_INLINE Packet2d ploaddup<Packet2d>(
const double* from)
638 return vld1q_dup_f64(from);
640 template<> EIGEN_STRONG_INLINE
void pstore<double>(
double* to,
const Packet2d& from) { EIGEN_DEBUG_ALIGNED_STORE vst1q_f64(to, from); }
642 template<> EIGEN_STRONG_INLINE
void pstoreu<double>(
double* to,
const Packet2d& from) { EIGEN_DEBUG_UNALIGNED_STORE vst1q_f64(to, from); }
644 template<> EIGEN_DEVICE_FUNC
inline Packet2d pgather<double, Packet2d>(
const double* from,
Index stride)
646 Packet2d res = pset1<Packet2d>(0.0);
647 res = vsetq_lane_f64(from[0*stride], res, 0);
648 res = vsetq_lane_f64(from[1*stride], res, 1);
651 template<> EIGEN_DEVICE_FUNC
inline void pscatter<double, Packet2d>(
double* to,
const Packet2d& from,
Index stride)
653 to[stride*0] = vgetq_lane_f64(from, 0);
654 to[stride*1] = vgetq_lane_f64(from, 1);
656 template<> EIGEN_STRONG_INLINE
void prefetch<double>(
const double* addr) { EIGEN_ARM_PREFETCH(addr); }
659 template<> EIGEN_STRONG_INLINE
double pfirst<Packet2d>(
const Packet2d& a) {
return vgetq_lane_f64(a, 0); }
661 template<> EIGEN_STRONG_INLINE Packet2d preverse(
const Packet2d& a) {
return vcombine_f64(vget_high_f64(a), vget_low_f64(a)); }
663 template<> EIGEN_STRONG_INLINE Packet2d pabs(
const Packet2d& a) {
return vabsq_f64(a); }
665 #if EIGEN_COMP_CLANG && defined(__apple_build_version__) 667 template<> EIGEN_STRONG_INLINE
double predux<Packet2d>(
const Packet2d& a) {
return (vget_low_f64(a) + vget_high_f64(a))[0]; }
669 template<> EIGEN_STRONG_INLINE
double predux<Packet2d>(
const Packet2d& a) {
return vget_lane_f64(vget_low_f64(a) + vget_high_f64(a), 0); }
672 template<> EIGEN_STRONG_INLINE Packet2d preduxp<Packet2d>(
const Packet2d* vecs)
674 float64x2_t trn1, trn2;
678 trn1 = vzip1q_f64(vecs[0], vecs[1]);
679 trn2 = vzip2q_f64(vecs[0], vecs[1]);
682 return vaddq_f64(trn1, trn2);
686 #if EIGEN_COMP_CLANG && defined(__apple_build_version__) 687 template<> EIGEN_STRONG_INLINE
double predux_mul<Packet2d>(
const Packet2d& a) {
return (vget_low_f64(a) * vget_high_f64(a))[0]; }
689 template<> EIGEN_STRONG_INLINE
double predux_mul<Packet2d>(
const Packet2d& a) {
return vget_lane_f64(vget_low_f64(a) * vget_high_f64(a), 0); }
693 template<> EIGEN_STRONG_INLINE
double predux_min<Packet2d>(
const Packet2d& a) {
return vgetq_lane_f64(vpminq_f64(a, a), 0); }
696 template<> EIGEN_STRONG_INLINE
double predux_max<Packet2d>(
const Packet2d& a) {
return vgetq_lane_f64(vpmaxq_f64(a, a), 0); }
700 #define PALIGN_NEON(Offset,Type,Command) \ 702 struct palign_impl<Offset,Type>\ 704 EIGEN_STRONG_INLINE static void run(Type& first, const Type& second)\ 707 first = Command(first, second, Offset);\ 711 PALIGN_NEON(0,Packet2d,vextq_f64)
712 PALIGN_NEON(1,Packet2d,vextq_f64)
715 EIGEN_DEVICE_FUNC
inline void 716 ptranspose(PacketBlock<Packet2d,2>& kernel) {
717 float64x2_t trn1 = vzip1q_f64(kernel.packet[0], kernel.packet[1]);
718 float64x2_t trn2 = vzip2q_f64(kernel.packet[0], kernel.packet[1]);
720 kernel.packet[0] = trn1;
721 kernel.packet[1] = trn2;
723 #endif // EIGEN_ARCH_ARM64 729 #endif // EIGEN_PACKET_MATH_NEON_H Definition: Constants.h:230
Namespace containing all symbols from the Eigen library.
Definition: Core:287
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:33
Definition: Eigen_Colamd.h:50