ZVector/PacketMath.h
Go to the documentation of this file.
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2016 Konstantinos Margaritis <markos@freevec.org>
5 //
6 // This Source Code Form is subject to the terms of the Mozilla
7 // Public License v. 2.0. If a copy of the MPL was not distributed
8 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 
10 #ifndef EIGEN_PACKET_MATH_ZVECTOR_H
11 #define EIGEN_PACKET_MATH_ZVECTOR_H
12 
13 // IWYU pragma: private
14 #include "../../InternalHeaderCheck.h"
15 
16 namespace Eigen {
17 
18 namespace internal {
19 
20 #ifndef EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD
21 #define EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD 16
22 #endif
23 
24 #ifndef EIGEN_HAS_SINGLE_INSTRUCTION_MADD
25 #define EIGEN_HAS_SINGLE_INSTRUCTION_MADD
26 #endif
27 
28 #ifndef EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS
29 #define EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS 32
30 #endif
31 
32 typedef __vector int Packet4i;
33 typedef __vector unsigned int Packet4ui;
34 typedef __vector __bool int Packet4bi;
35 typedef __vector short int Packet8i;
36 typedef __vector unsigned char Packet16uc;
37 typedef __vector double Packet2d;
38 typedef __vector unsigned long long Packet2ul;
39 typedef __vector long long Packet2l;
40 
41 // Z14 has builtin support for float vectors
42 #if !defined(__ARCH__) || (defined(__ARCH__) && __ARCH__ >= 12)
43 typedef __vector float Packet4f;
44 #else
45 typedef struct {
46  Packet2d v4f[2];
47 } Packet4f;
48 #endif
49 
50 typedef union {
55  double d[2];
56  float f[4];
62 #if !defined(__ARCH__) || (defined(__ARCH__) && __ARCH__ >= 12)
64 #endif
65 } Packet;
66 
67 // We don't want to write the same code all the time, but we need to reuse the constants
68 // and it doesn't really work to declare them global, so we define macros instead
69 
70 #define EIGEN_DECLARE_CONST_FAST_Packet4i(NAME, X) Packet4i p4i_##NAME = reinterpret_cast<Packet4i>(vec_splat_s32(X))
71 
72 #define EIGEN_DECLARE_CONST_FAST_Packet2d(NAME, X) Packet2d p2d_##NAME = reinterpret_cast<Packet2d>(vec_splat_s64(X))
73 
74 #define EIGEN_DECLARE_CONST_FAST_Packet2l(NAME, X) Packet2l p2l_##NAME = reinterpret_cast<Packet2l>(vec_splat_s64(X))
75 
76 #define EIGEN_DECLARE_CONST_Packet4i(NAME, X) Packet4i p4i_##NAME = pset1<Packet4i>(X)
77 
78 #define EIGEN_DECLARE_CONST_Packet2d(NAME, X) Packet2d p2d_##NAME = pset1<Packet2d>(X)
79 
80 #define EIGEN_DECLARE_CONST_Packet2l(NAME, X) Packet2l p2l_##NAME = pset1<Packet2l>(X)
81 
82 // These constants are endian-agnostic
83 static EIGEN_DECLARE_CONST_FAST_Packet4i(ZERO, 0); //{ 0, 0, 0, 0,}
84 static EIGEN_DECLARE_CONST_FAST_Packet4i(ONE, 1); //{ 1, 1, 1, 1}
85 
89 
90 static Packet2d p2d_ONE = {1.0, 1.0};
91 static Packet2d p2d_ZERO_ = {numext::bit_cast<double>(0x8000000000000000ull),
92  numext::bit_cast<double>(0x8000000000000000ull)};
93 
94 #if !defined(__ARCH__) || (defined(__ARCH__) && __ARCH__ >= 12)
95 #define EIGEN_DECLARE_CONST_FAST_Packet4f(NAME, X) Packet4f p4f_##NAME = reinterpret_cast<Packet4f>(vec_splat_s32(X))
96 
97 #define EIGEN_DECLARE_CONST_Packet4f(NAME, X) Packet4f p4f_##NAME = pset1<Packet4f>(X)
98 
99 #define EIGEN_DECLARE_CONST_Packet4f_FROM_INT(NAME, X) \
100  const Packet4f p4f_##NAME = reinterpret_cast<Packet4f>(pset1<Packet4i>(X))
101 
102 static EIGEN_DECLARE_CONST_FAST_Packet4f(ZERO, 0); //{ 0.0, 0.0, 0.0, 0.0}
103 static EIGEN_DECLARE_CONST_FAST_Packet4i(MINUS1, -1); //{ -1, -1, -1, -1}
104 static Packet4f p4f_MZERO = {0x80000000, 0x80000000, 0x80000000, 0x80000000};
105 #endif
106 
107 static Packet4i p4i_COUNTDOWN = {0, 1, 2, 3};
108 static Packet4f p4f_COUNTDOWN = {0.0, 1.0, 2.0, 3.0};
109 static Packet2d p2d_COUNTDOWN = reinterpret_cast<Packet2d>(
110  vec_sld(reinterpret_cast<Packet16uc>(p2d_ZERO), reinterpret_cast<Packet16uc>(p2d_ONE), 8));
111 
112 static Packet16uc p16uc_PSET64_HI = {0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7};
113 static Packet16uc p16uc_DUPLICATE32_HI = {0, 1, 2, 3, 0, 1, 2, 3, 4, 5, 6, 7, 4, 5, 6, 7};
114 
115 // Mask alignment
116 #define EIGEN_MASK_ALIGNMENT 0xfffffffffffffff0
117 
118 #define EIGEN_ALIGNED_PTR(x) ((std::ptrdiff_t)(x) & EIGEN_MASK_ALIGNMENT)
119 
120 // Handle endianness properly while loading constants
121 // Define global static constants:
122 
123 static Packet16uc p16uc_FORWARD = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
124 static Packet16uc p16uc_REVERSE32 = {12, 13, 14, 15, 8, 9, 10, 11, 4, 5, 6, 7, 0, 1, 2, 3};
125 static Packet16uc p16uc_REVERSE64 = {8, 9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7};
126 
128  vec_sld((Packet16uc)vec_splat((Packet4ui)p16uc_FORWARD, 0), (Packet16uc)vec_splat((Packet4ui)p16uc_FORWARD, 2),
129  8); //{ 0,1,2,3, 0,1,2,3, 8,9,10,11, 8,9,10,11 };
131  8); //{ 4,5,6,7, 4,5,6,7, 12,13,14,15, 12,13,14,15 };
132 /*static Packet16uc p16uc_HALF64_0_16 = vec_sld((Packet16uc)p4i_ZERO, vec_splat((Packet16uc) vec_abs(p4i_MINUS16), 3),
133 8); //{ 0,0,0,0, 0,0,0,0, 16,16,16,16, 16,16,16,16};
134 
135 static Packet16uc p16uc_PSET64_HI = (Packet16uc) vec_mergeh((Packet4ui)p16uc_PSET32_WODD,
136 (Packet4ui)p16uc_PSET32_WEVEN); //{ 0,1,2,3, 4,5,6,7, 0,1,2,3, 4,5,6,7 };*/
137 static Packet16uc p16uc_PSET64_LO = (Packet16uc)vec_mergel(
138  (Packet4ui)p16uc_PSET32_WODD, (Packet4ui)p16uc_PSET32_WEVEN); //{ 8,9,10,11, 12,13,14,15, 8,9,10,11, 12,13,14,15 };
139 /*static Packet16uc p16uc_TRANSPOSE64_HI = vec_add(p16uc_PSET64_HI, p16uc_HALF64_0_16); //{ 0,1,2,3, 4,5,6,7,
140 16,17,18,19, 20,21,22,23}; static Packet16uc p16uc_TRANSPOSE64_LO = vec_add(p16uc_PSET64_LO, p16uc_HALF64_0_16); //{
141 8,9,10,11, 12,13,14,15, 24,25,26,27, 28,29,30,31};*/
142 static Packet16uc p16uc_TRANSPOSE64_HI = {0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22, 23};
143 static Packet16uc p16uc_TRANSPOSE64_LO = {8, 9, 10, 11, 12, 13, 14, 15, 24, 25, 26, 27, 28, 29, 30, 31};
144 
146  vec_sld(p16uc_REVERSE32, p16uc_REVERSE32, 8); //{ 4,5,6,7, 0,1,2,3, 12,13,14,15, 8,9,10,11 };
147 
149  vec_sld(p16uc_FORWARD, p16uc_FORWARD, 8); //{ 8,9,10,11, 12,13,14,15, 0,1,2,3, 4,5,6,7 };
150 
151 #if EIGEN_HAS_BUILTIN(__builtin_prefetch) || EIGEN_COMP_GNUC
152 #define EIGEN_ZVECTOR_PREFETCH(ADDR) __builtin_prefetch(ADDR);
153 #else
154 #define EIGEN_ZVECTOR_PREFETCH(ADDR) asm(" pfd [%[addr]]\n" ::[addr] "r"(ADDR) : "cc");
155 #endif
156 
157 template <>
158 struct packet_traits<int> : default_packet_traits {
159  typedef Packet4i type;
160  typedef Packet4i half;
161  enum {
162  Vectorizable = 1,
163  AlignedOnScalar = 1,
164  size = 4,
165 
166  HasAdd = 1,
167  HasSub = 1,
168  HasMul = 1,
169  HasDiv = 1,
170  HasBlend = 1
171  };
172 };
173 
174 template <>
175 struct packet_traits<float> : default_packet_traits {
176  typedef Packet4f type;
177  typedef Packet4f half;
178  enum {
179  Vectorizable = 1,
180  AlignedOnScalar = 1,
181  size = 4,
182 
183  HasAdd = 1,
184  HasSub = 1,
185  HasMul = 1,
186  HasDiv = 1,
187  HasMin = 1,
188  HasMax = 1,
189  HasAbs = 1,
190  HasSin = 0,
191  HasCos = 0,
192  HasLog = 0,
193  HasExp = 1,
194  HasSqrt = 1,
195  HasRsqrt = 1,
196  HasTanh = 1,
197  HasErf = 1,
198  HasNegate = 1,
199  HasBlend = 1
200  };
201 };
202 
203 template <>
204 struct packet_traits<double> : default_packet_traits {
205  typedef Packet2d type;
206  typedef Packet2d half;
207  enum {
208  Vectorizable = 1,
209  AlignedOnScalar = 1,
210  size = 2,
211 
212  HasAdd = 1,
213  HasSub = 1,
214  HasMul = 1,
215  HasDiv = 1,
216  HasMin = 1,
217  HasMax = 1,
218  HasAbs = 1,
219  HasSin = 0,
220  HasCos = 0,
221  HasLog = 0,
222  HasExp = 1,
223  HasSqrt = 1,
224  HasRsqrt = 1,
226  HasBlend = 1
227  };
228 };
229 
230 template <>
231 struct unpacket_traits<Packet4i> {
232  typedef int type;
233  enum {
234  size = 4,
236  vectorizable = true,
237  masked_load_available = false,
238  masked_store_available = false
239  };
240  typedef Packet4i half;
241 };
242 template <>
243 struct unpacket_traits<Packet4f> {
244  typedef float type;
245  enum {
246  size = 4,
248  vectorizable = true,
249  masked_load_available = false,
250  masked_store_available = false
251  };
252  typedef Packet4f half;
253 };
254 template <>
255 struct unpacket_traits<Packet2d> {
256  typedef double type;
257  enum {
258  size = 2,
260  vectorizable = true,
261  masked_load_available = false,
262  masked_store_available = false
263  };
264  typedef Packet2d half;
265 };
266 
267 /* Forward declaration */
269 
270 inline std::ostream& operator<<(std::ostream& s, const Packet4i& v) {
271  Packet vt;
272  vt.v4i = v;
273  s << vt.i[0] << ", " << vt.i[1] << ", " << vt.i[2] << ", " << vt.i[3];
274  return s;
275 }
276 
277 inline std::ostream& operator<<(std::ostream& s, const Packet4ui& v) {
278  Packet vt;
279  vt.v4ui = v;
280  s << vt.ui[0] << ", " << vt.ui[1] << ", " << vt.ui[2] << ", " << vt.ui[3];
281  return s;
282 }
283 
284 inline std::ostream& operator<<(std::ostream& s, const Packet2l& v) {
285  Packet vt;
286  vt.v2l = v;
287  s << vt.l[0] << ", " << vt.l[1];
288  return s;
289 }
290 
291 inline std::ostream& operator<<(std::ostream& s, const Packet2ul& v) {
292  Packet vt;
293  vt.v2ul = v;
294  s << vt.ul[0] << ", " << vt.ul[1];
295  return s;
296 }
297 
298 inline std::ostream& operator<<(std::ostream& s, const Packet2d& v) {
299  Packet vt;
300  vt.v2d = v;
301  s << vt.d[0] << ", " << vt.d[1];
302  return s;
303 }
304 
305 #if !defined(__ARCH__) || (defined(__ARCH__) && __ARCH__ >= 12)
306 inline std::ostream& operator<<(std::ostream& s, const Packet4f& v) {
307  Packet vt;
308  vt.v4f = v;
309  s << vt.f[0] << ", " << vt.f[1] << ", " << vt.f[2] << ", " << vt.f[3];
310  return s;
311 }
312 #endif
313 
314 template <>
316  // FIXME: No intrinsic yet
318  Packet* vfrom;
319  vfrom = (Packet*)from;
320  return vfrom->v4i;
321 }
322 
323 template <>
324 EIGEN_STRONG_INLINE Packet2d pload<Packet2d>(const double* from) {
325  // FIXME: No intrinsic yet
327  Packet* vfrom;
328  vfrom = (Packet*)from;
329  return vfrom->v2d;
330 }
331 
332 template <>
333 EIGEN_STRONG_INLINE void pstore<int>(int* to, const Packet4i& from) {
334  // FIXME: No intrinsic yet
336  Packet* vto;
337  vto = (Packet*)to;
338  vto->v4i = from;
339 }
340 
341 template <>
342 EIGEN_STRONG_INLINE void pstore<double>(double* to, const Packet2d& from) {
343  // FIXME: No intrinsic yet
345  Packet* vto;
346  vto = (Packet*)to;
347  vto->v2d = from;
348 }
349 
350 template <>
352  return vec_splats(from);
353 }
354 template <>
355 EIGEN_STRONG_INLINE Packet2d pset1<Packet2d>(const double& from) {
356  return vec_splats(from);
357 }
358 
359 template <>
360 EIGEN_STRONG_INLINE void pbroadcast4<Packet4i>(const int* a, Packet4i& a0, Packet4i& a1, Packet4i& a2, Packet4i& a3) {
361  a3 = pload<Packet4i>(a);
362  a0 = vec_splat(a3, 0);
363  a1 = vec_splat(a3, 1);
364  a2 = vec_splat(a3, 2);
365  a3 = vec_splat(a3, 3);
366 }
367 
368 template <>
369 EIGEN_STRONG_INLINE void pbroadcast4<Packet2d>(const double* a, Packet2d& a0, Packet2d& a1, Packet2d& a2,
370  Packet2d& a3) {
371  a1 = pload<Packet2d>(a);
372  a0 = vec_splat(a1, 0);
373  a1 = vec_splat(a1, 1);
374  a3 = pload<Packet2d>(a + 2);
375  a2 = vec_splat(a3, 0);
376  a3 = vec_splat(a3, 1);
377 }
378 
379 template <>
380 EIGEN_DEVICE_FUNC inline Packet4i pgather<int, Packet4i>(const int* from, Index stride) {
381  EIGEN_ALIGN16 int ai[4];
382  ai[0] = from[0 * stride];
383  ai[1] = from[1 * stride];
384  ai[2] = from[2 * stride];
385  ai[3] = from[3 * stride];
386  return pload<Packet4i>(ai);
387 }
388 
389 template <>
390 EIGEN_DEVICE_FUNC inline Packet2d pgather<double, Packet2d>(const double* from, Index stride) {
391  EIGEN_ALIGN16 double af[2];
392  af[0] = from[0 * stride];
393  af[1] = from[1 * stride];
394  return pload<Packet2d>(af);
395 }
396 
397 template <>
398 EIGEN_DEVICE_FUNC inline void pscatter<int, Packet4i>(int* to, const Packet4i& from, Index stride) {
399  EIGEN_ALIGN16 int ai[4];
400  pstore<int>((int*)ai, from);
401  to[0 * stride] = ai[0];
402  to[1 * stride] = ai[1];
403  to[2 * stride] = ai[2];
404  to[3 * stride] = ai[3];
405 }
406 
407 template <>
408 EIGEN_DEVICE_FUNC inline void pscatter<double, Packet2d>(double* to, const Packet2d& from, Index stride) {
409  EIGEN_ALIGN16 double af[2];
410  pstore<double>(af, from);
411  to[0 * stride] = af[0];
412  to[1 * stride] = af[1];
413 }
414 
415 template <>
417  return (a + b);
418 }
419 template <>
421  return (a + b);
422 }
423 
424 template <>
426  return (a - b);
427 }
428 template <>
430  return (a - b);
431 }
432 
433 template <>
435  return (a * b);
436 }
437 template <>
439  return (a * b);
440 }
441 
442 template <>
444  return (a / b);
445 }
446 template <>
448  return (a / b);
449 }
450 
451 template <>
453  return (-a);
454 }
455 template <>
457  return (-a);
458 }
459 
460 template <>
462  return a;
463 }
464 template <>
466  return a;
467 }
468 
469 template <>
470 EIGEN_STRONG_INLINE Packet4i pmadd(const Packet4i& a, const Packet4i& b, const Packet4i& c) {
471  return padd<Packet4i>(pmul<Packet4i>(a, b), c);
472 }
473 template <>
474 EIGEN_STRONG_INLINE Packet2d pmadd(const Packet2d& a, const Packet2d& b, const Packet2d& c) {
475  return vec_madd(a, b, c);
476 }
477 
478 template <>
481 }
482 template <>
485 }
486 
487 template <>
489  return vec_min(a, b);
490 }
491 template <>
493  return vec_min(a, b);
494 }
495 
496 template <>
498  return vec_max(a, b);
499 }
500 template <>
502  return vec_max(a, b);
503 }
504 
505 template <>
507  return vec_and(a, b);
508 }
509 template <>
511  return vec_and(a, b);
512 }
513 
514 template <>
516  return vec_or(a, b);
517 }
518 template <>
520  return vec_or(a, b);
521 }
522 
523 template <>
525  return vec_xor(a, b);
526 }
527 template <>
529  return vec_xor(a, b);
530 }
531 
532 template <>
534  return pand<Packet4i>(a, vec_nor(b, b));
535 }
536 template <>
538  return vec_and(a, vec_nor(b, b));
539 }
540 
541 template <>
543  return vec_round(a);
544 }
545 template <>
547  return vec_ceil(a);
548 }
549 template <>
551  return vec_floor(a);
552 }
553 
554 template <>
556  return pload<Packet4i>(from);
557 }
558 template <>
559 EIGEN_STRONG_INLINE Packet2d ploadu<Packet2d>(const double* from) {
560  return pload<Packet2d>(from);
561 }
562 
563 template <>
565  Packet4i p = pload<Packet4i>(from);
566  return vec_perm(p, p, p16uc_DUPLICATE32_HI);
567 }
568 
569 template <>
570 EIGEN_STRONG_INLINE Packet2d ploaddup<Packet2d>(const double* from) {
571  Packet2d p = pload<Packet2d>(from);
572  return vec_perm(p, p, p16uc_PSET64_HI);
573 }
574 
575 template <>
576 EIGEN_STRONG_INLINE void pstoreu<int>(int* to, const Packet4i& from) {
577  pstore<int>(to, from);
578 }
579 template <>
580 EIGEN_STRONG_INLINE void pstoreu<double>(double* to, const Packet2d& from) {
581  pstore<double>(to, from);
582 }
583 
584 template <>
585 EIGEN_STRONG_INLINE void prefetch<int>(const int* addr) {
587 }
588 template <>
589 EIGEN_STRONG_INLINE void prefetch<double>(const double* addr) {
591 }
592 
593 template <>
595  EIGEN_ALIGN16 int x[4];
596  pstore(x, a);
597  return x[0];
598 }
599 template <>
601  EIGEN_ALIGN16 double x[2];
602  pstore(x, a);
603  return x[0];
604 }
605 
606 template <>
608  return reinterpret_cast<Packet4i>(
609  vec_perm(reinterpret_cast<Packet16uc>(a), reinterpret_cast<Packet16uc>(a), p16uc_REVERSE32));
610 }
611 
612 template <>
614  return reinterpret_cast<Packet2d>(
615  vec_perm(reinterpret_cast<Packet16uc>(a), reinterpret_cast<Packet16uc>(a), p16uc_REVERSE64));
616 }
617 
618 template <>
620  return vec_abs(a);
621 }
622 template <>
624  return vec_abs(a);
625 }
626 
627 template <>
629  Packet4i b, sum;
630  b = vec_sld(a, a, 8);
631  sum = padd<Packet4i>(a, b);
632  b = vec_sld(sum, sum, 4);
633  sum = padd<Packet4i>(sum, b);
634  return pfirst(sum);
635 }
636 
637 template <>
639  Packet2d b, sum;
640  b = reinterpret_cast<Packet2d>(vec_sld(reinterpret_cast<Packet4i>(a), reinterpret_cast<Packet4i>(a), 8));
641  sum = padd<Packet2d>(a, b);
642  return pfirst(sum);
643 }
644 
645 // Other reduction functions:
646 // mul
647 template <>
649  EIGEN_ALIGN16 int aux[4];
650  pstore(aux, a);
651  return aux[0] * aux[1] * aux[2] * aux[3];
652 }
653 
654 template <>
656  return pfirst(
657  pmul(a, reinterpret_cast<Packet2d>(vec_sld(reinterpret_cast<Packet4i>(a), reinterpret_cast<Packet4i>(a), 8))));
658 }
659 
660 // min
661 template <>
663  Packet4i b, res;
664  b = pmin<Packet4i>(a, vec_sld(a, a, 8));
665  res = pmin<Packet4i>(b, vec_sld(b, b, 4));
666  return pfirst(res);
667 }
668 
669 template <>
671  return pfirst(pmin<Packet2d>(
672  a, reinterpret_cast<Packet2d>(vec_sld(reinterpret_cast<Packet4i>(a), reinterpret_cast<Packet4i>(a), 8))));
673 }
674 
675 // max
676 template <>
678  Packet4i b, res;
679  b = pmax<Packet4i>(a, vec_sld(a, a, 8));
680  res = pmax<Packet4i>(b, vec_sld(b, b, 4));
681  return pfirst(res);
682 }
683 
684 // max
685 template <>
687  return pfirst(pmax<Packet2d>(
688  a, reinterpret_cast<Packet2d>(vec_sld(reinterpret_cast<Packet4i>(a), reinterpret_cast<Packet4i>(a), 8))));
689 }
690 
691 EIGEN_DEVICE_FUNC inline void ptranspose(PacketBlock<Packet4i, 4>& kernel) {
692  Packet4i t0 = vec_mergeh(kernel.packet[0], kernel.packet[2]);
693  Packet4i t1 = vec_mergel(kernel.packet[0], kernel.packet[2]);
694  Packet4i t2 = vec_mergeh(kernel.packet[1], kernel.packet[3]);
695  Packet4i t3 = vec_mergel(kernel.packet[1], kernel.packet[3]);
696  kernel.packet[0] = vec_mergeh(t0, t2);
697  kernel.packet[1] = vec_mergel(t0, t2);
698  kernel.packet[2] = vec_mergeh(t1, t3);
699  kernel.packet[3] = vec_mergel(t1, t3);
700 }
701 
702 EIGEN_DEVICE_FUNC inline void ptranspose(PacketBlock<Packet2d, 2>& kernel) {
703  Packet2d t0 = vec_perm(kernel.packet[0], kernel.packet[1], p16uc_TRANSPOSE64_HI);
704  Packet2d t1 = vec_perm(kernel.packet[0], kernel.packet[1], p16uc_TRANSPOSE64_LO);
705  kernel.packet[0] = t0;
706  kernel.packet[1] = t1;
707 }
708 
709 template <>
710 EIGEN_STRONG_INLINE Packet4i pblend(const Selector<4>& ifPacket, const Packet4i& thenPacket,
711  const Packet4i& elsePacket) {
712  Packet4ui select = {ifPacket.select[0], ifPacket.select[1], ifPacket.select[2], ifPacket.select[3]};
713  Packet4ui mask = vec_cmpeq(select, reinterpret_cast<Packet4ui>(p4i_ONE));
714  return vec_sel(elsePacket, thenPacket, mask);
715 }
716 
717 template <>
718 EIGEN_STRONG_INLINE Packet2d pblend(const Selector<2>& ifPacket, const Packet2d& thenPacket,
719  const Packet2d& elsePacket) {
720  Packet2ul select = {ifPacket.select[0], ifPacket.select[1]};
721  Packet2ul mask = vec_cmpeq(select, reinterpret_cast<Packet2ul>(p2l_ONE));
722  return vec_sel(elsePacket, thenPacket, mask);
723 }
724 
725 /* z13 has no vector float support so we emulate that with double
726  z14 has proper vector float support.
727 */
728 #if !defined(__ARCH__) || (defined(__ARCH__) && __ARCH__ < 12)
729 /* Helper function to simulate a vec_splat_packet4f
730  */
731 template <int element>
733  Packet4f splat;
734  switch (element) {
735  case 0:
736  splat.v4f[0] = vec_splat(from.v4f[0], 0);
737  splat.v4f[1] = splat.v4f[0];
738  break;
739  case 1:
740  splat.v4f[0] = vec_splat(from.v4f[0], 1);
741  splat.v4f[1] = splat.v4f[0];
742  break;
743  case 2:
744  splat.v4f[0] = vec_splat(from.v4f[1], 0);
745  splat.v4f[1] = splat.v4f[0];
746  break;
747  case 3:
748  splat.v4f[0] = vec_splat(from.v4f[1], 1);
749  splat.v4f[1] = splat.v4f[0];
750  break;
751  }
752  return splat;
753 }
754 
755 template <>
756 EIGEN_STRONG_INLINE Packet4f pload<Packet4f>(const float* from) {
757  // FIXME: No intrinsic yet
759  Packet4f vfrom;
760  vfrom.v4f[0] = vec_ld2f(&from[0]);
761  vfrom.v4f[1] = vec_ld2f(&from[2]);
762  return vfrom;
763 }
764 
765 template <>
766 EIGEN_STRONG_INLINE void pstore<float>(float* to, const Packet4f& from) {
767  // FIXME: No intrinsic yet
769  vec_st2f(from.v4f[0], &to[0]);
770  vec_st2f(from.v4f[1], &to[2]);
771 }
772 
773 template <>
774 EIGEN_STRONG_INLINE Packet4f pset1<Packet4f>(const float& from) {
775  Packet4f to;
776  to.v4f[0] = pset1<Packet2d>(static_cast<const double&>(from));
777  to.v4f[1] = to.v4f[0];
778  return to;
779 }
780 
781 template <>
782 EIGEN_STRONG_INLINE void pbroadcast4<Packet4f>(const float* a, Packet4f& a0, Packet4f& a1, Packet4f& a2, Packet4f& a3) {
783  a3 = pload<Packet4f>(a);
784  a0 = vec_splat_packet4f<0>(a3);
785  a1 = vec_splat_packet4f<1>(a3);
786  a2 = vec_splat_packet4f<2>(a3);
787  a3 = vec_splat_packet4f<3>(a3);
788 }
789 
790 template <>
791 EIGEN_DEVICE_FUNC inline Packet4f pgather<float, Packet4f>(const float* from, Index stride) {
792  EIGEN_ALIGN16 float ai[4];
793  ai[0] = from[0 * stride];
794  ai[1] = from[1 * stride];
795  ai[2] = from[2 * stride];
796  ai[3] = from[3 * stride];
797  return pload<Packet4f>(ai);
798 }
799 
800 template <>
801 EIGEN_DEVICE_FUNC inline void pscatter<float, Packet4f>(float* to, const Packet4f& from, Index stride) {
802  EIGEN_ALIGN16 float ai[4];
803  pstore<float>((float*)ai, from);
804  to[0 * stride] = ai[0];
805  to[1 * stride] = ai[1];
806  to[2 * stride] = ai[2];
807  to[3 * stride] = ai[3];
808 }
809 
810 template <>
812  Packet4f c;
813  c.v4f[0] = a.v4f[0] + b.v4f[0];
814  c.v4f[1] = a.v4f[1] + b.v4f[1];
815  return c;
816 }
817 
818 template <>
820  Packet4f c;
821  c.v4f[0] = a.v4f[0] - b.v4f[0];
822  c.v4f[1] = a.v4f[1] - b.v4f[1];
823  return c;
824 }
825 
826 template <>
828  Packet4f c;
829  c.v4f[0] = a.v4f[0] * b.v4f[0];
830  c.v4f[1] = a.v4f[1] * b.v4f[1];
831  return c;
832 }
833 
834 template <>
836  Packet4f c;
837  c.v4f[0] = a.v4f[0] / b.v4f[0];
838  c.v4f[1] = a.v4f[1] / b.v4f[1];
839  return c;
840 }
841 
842 template <>
844  Packet4f c;
845  c.v4f[0] = -a.v4f[0];
846  c.v4f[1] = -a.v4f[1];
847  return c;
848 }
849 
850 template <>
851 EIGEN_STRONG_INLINE Packet4f pmadd(const Packet4f& a, const Packet4f& b, const Packet4f& c) {
852  Packet4f res;
853  res.v4f[0] = vec_madd(a.v4f[0], b.v4f[0], c.v4f[0]);
854  res.v4f[1] = vec_madd(a.v4f[1], b.v4f[1], c.v4f[1]);
855  return res;
856 }
857 
858 template <>
860  Packet4f res;
861  res.v4f[0] = pmin(a.v4f[0], b.v4f[0]);
862  res.v4f[1] = pmin(a.v4f[1], b.v4f[1]);
863  return res;
864 }
865 
866 template <>
868  Packet4f res;
869  res.v4f[0] = pmax(a.v4f[0], b.v4f[0]);
870  res.v4f[1] = pmax(a.v4f[1], b.v4f[1]);
871  return res;
872 }
873 
874 template <>
876  Packet4f res;
877  res.v4f[0] = pand(a.v4f[0], b.v4f[0]);
878  res.v4f[1] = pand(a.v4f[1], b.v4f[1]);
879  return res;
880 }
881 
882 template <>
884  Packet4f res;
885  res.v4f[0] = por(a.v4f[0], b.v4f[0]);
886  res.v4f[1] = por(a.v4f[1], b.v4f[1]);
887  return res;
888 }
889 
890 template <>
892  Packet4f res;
893  res.v4f[0] = pxor(a.v4f[0], b.v4f[0]);
894  res.v4f[1] = pxor(a.v4f[1], b.v4f[1]);
895  return res;
896 }
897 
898 template <>
900  Packet4f res;
901  res.v4f[0] = pandnot(a.v4f[0], b.v4f[0]);
902  res.v4f[1] = pandnot(a.v4f[1], b.v4f[1]);
903  return res;
904 }
905 
906 template <>
908  Packet4f res;
909  res.v4f[0] = vec_round(a.v4f[0]);
910  res.v4f[1] = vec_round(a.v4f[1]);
911  return res;
912 }
913 
914 template <>
916  Packet4f res;
917  res.v4f[0] = vec_ceil(a.v4f[0]);
918  res.v4f[1] = vec_ceil(a.v4f[1]);
919  return res;
920 }
921 
922 template <>
924  Packet4f res;
925  res.v4f[0] = vec_floor(a.v4f[0]);
926  res.v4f[1] = vec_floor(a.v4f[1]);
927  return res;
928 }
929 
930 template <>
932  Packet4f p = pload<Packet4f>(from);
933  p.v4f[1] = vec_splat(p.v4f[0], 1);
934  p.v4f[0] = vec_splat(p.v4f[0], 0);
935  return p;
936 }
937 
938 template <>
940  EIGEN_ALIGN16 float x[2];
941  vec_st2f(a.v4f[0], &x[0]);
942  return x[0];
943 }
944 
945 template <>
947  Packet4f rev;
948  rev.v4f[0] = preverse<Packet2d>(a.v4f[1]);
949  rev.v4f[1] = preverse<Packet2d>(a.v4f[0]);
950  return rev;
951 }
952 
953 template <>
955  Packet4f res;
956  res.v4f[0] = pabs(a.v4f[0]);
957  res.v4f[1] = pabs(a.v4f[1]);
958  return res;
959 }
960 
961 template <>
963  Packet2d sum;
964  sum = padd<Packet2d>(a.v4f[0], a.v4f[1]);
965  double first = predux<Packet2d>(sum);
966  return static_cast<float>(first);
967 }
968 
969 template <>
971  // Return predux_mul<Packet2d> of the subvectors product
972  return static_cast<float>(pfirst(predux_mul(pmul(a.v4f[0], a.v4f[1]))));
973 }
974 
975 template <>
977  Packet2d b, res;
978  b = pmin<Packet2d>(a.v4f[0], a.v4f[1]);
980  b, reinterpret_cast<Packet2d>(vec_sld(reinterpret_cast<Packet4i>(b), reinterpret_cast<Packet4i>(b), 8)));
981  return static_cast<float>(pfirst(res));
982 }
983 
984 template <>
986  Packet2d b, res;
987  b = pmax<Packet2d>(a.v4f[0], a.v4f[1]);
989  b, reinterpret_cast<Packet2d>(vec_sld(reinterpret_cast<Packet4i>(b), reinterpret_cast<Packet4i>(b), 8)));
990  return static_cast<float>(pfirst(res));
991 }
992 
993 /* Split the Packet4f PacketBlock into 4 Packet2d PacketBlocks and transpose each one
994  */
995 EIGEN_DEVICE_FUNC inline void ptranspose(PacketBlock<Packet4f, 4>& kernel) {
996  PacketBlock<Packet2d, 2> t0, t1, t2, t3;
997  // copy top-left 2x2 Packet2d block
998  t0.packet[0] = kernel.packet[0].v4f[0];
999  t0.packet[1] = kernel.packet[1].v4f[0];
1000 
1001  // copy top-right 2x2 Packet2d block
1002  t1.packet[0] = kernel.packet[0].v4f[1];
1003  t1.packet[1] = kernel.packet[1].v4f[1];
1004 
1005  // copy bottom-left 2x2 Packet2d block
1006  t2.packet[0] = kernel.packet[2].v4f[0];
1007  t2.packet[1] = kernel.packet[3].v4f[0];
1008 
1009  // copy bottom-right 2x2 Packet2d block
1010  t3.packet[0] = kernel.packet[2].v4f[1];
1011  t3.packet[1] = kernel.packet[3].v4f[1];
1012 
1013  // Transpose all 2x2 blocks
1014  ptranspose(t0);
1015  ptranspose(t1);
1016  ptranspose(t2);
1017  ptranspose(t3);
1018 
1019  // Copy back transposed blocks, but exchange t1 and t2 due to transposition
1020  kernel.packet[0].v4f[0] = t0.packet[0];
1021  kernel.packet[0].v4f[1] = t2.packet[0];
1022  kernel.packet[1].v4f[0] = t0.packet[1];
1023  kernel.packet[1].v4f[1] = t2.packet[1];
1024  kernel.packet[2].v4f[0] = t1.packet[0];
1025  kernel.packet[2].v4f[1] = t3.packet[0];
1026  kernel.packet[3].v4f[0] = t1.packet[1];
1027  kernel.packet[3].v4f[1] = t3.packet[1];
1028 }
1029 
1030 template <>
1031 EIGEN_STRONG_INLINE Packet4f pblend(const Selector<4>& ifPacket, const Packet4f& thenPacket,
1032  const Packet4f& elsePacket) {
1033  Packet2ul select_hi = {ifPacket.select[0], ifPacket.select[1]};
1034  Packet2ul select_lo = {ifPacket.select[2], ifPacket.select[3]};
1035  Packet2ul mask_hi = vec_cmpeq(select_hi, reinterpret_cast<Packet2ul>(p2l_ONE));
1036  Packet2ul mask_lo = vec_cmpeq(select_lo, reinterpret_cast<Packet2ul>(p2l_ONE));
1037  Packet4f result;
1038  result.v4f[0] = vec_sel(elsePacket.v4f[0], thenPacket.v4f[0], mask_hi);
1039  result.v4f[1] = vec_sel(elsePacket.v4f[1], thenPacket.v4f[1], mask_lo);
1040  return result;
1041 }
1042 
1043 template <>
1045  Packet4f res;
1046  res.v4f[0] = pcmp_le(a.v4f[0], b.v4f[0]);
1047  res.v4f[1] = pcmp_le(a.v4f[1], b.v4f[1]);
1048  return res;
1049 }
1050 
1051 template <>
1053  Packet4f res;
1054  res.v4f[0] = pcmp_lt(a.v4f[0], b.v4f[0]);
1055  res.v4f[1] = pcmp_lt(a.v4f[1], b.v4f[1]);
1056  return res;
1057 }
1058 
1059 template <>
1061  Packet4f res;
1062  res.v4f[0] = pcmp_eq(a.v4f[0], b.v4f[0]);
1063  res.v4f[1] = pcmp_eq(a.v4f[1], b.v4f[1]);
1064  return res;
1065 }
1066 
1067 #else
1068 template <>
1069 EIGEN_STRONG_INLINE Packet4f pload<Packet4f>(const float* from) {
1070  // FIXME: No intrinsic yet
1072  Packet* vfrom;
1073  vfrom = (Packet*)from;
1074  return vfrom->v4f;
1075 }
1076 
1077 template <>
1078 EIGEN_STRONG_INLINE void pstore<float>(float* to, const Packet4f& from) {
1079  // FIXME: No intrinsic yet
1081  Packet* vto;
1082  vto = (Packet*)to;
1083  vto->v4f = from;
1084 }
1085 
1086 template <>
1087 EIGEN_STRONG_INLINE Packet4f pset1<Packet4f>(const float& from) {
1088  return vec_splats(from);
1089 }
1090 
1091 template <>
1092 EIGEN_STRONG_INLINE void pbroadcast4<Packet4f>(const float* a, Packet4f& a0, Packet4f& a1, Packet4f& a2, Packet4f& a3) {
1093  a3 = pload<Packet4f>(a);
1094  a0 = vec_splat(a3, 0);
1095  a1 = vec_splat(a3, 1);
1096  a2 = vec_splat(a3, 2);
1097  a3 = vec_splat(a3, 3);
1098 }
1099 
1100 template <>
1101 EIGEN_DEVICE_FUNC inline Packet4f pgather<float, Packet4f>(const float* from, Index stride) {
1102  EIGEN_ALIGN16 float af[4];
1103  af[0] = from[0 * stride];
1104  af[1] = from[1 * stride];
1105  af[2] = from[2 * stride];
1106  af[3] = from[3 * stride];
1107  return pload<Packet4f>(af);
1108 }
1109 
1110 template <>
1111 EIGEN_DEVICE_FUNC inline void pscatter<float, Packet4f>(float* to, const Packet4f& from, Index stride) {
1112  EIGEN_ALIGN16 float af[4];
1113  pstore<float>((float*)af, from);
1114  to[0 * stride] = af[0];
1115  to[1 * stride] = af[1];
1116  to[2 * stride] = af[2];
1117  to[3 * stride] = af[3];
1118 }
1119 
1120 template <>
1122  return (a + b);
1123 }
1124 template <>
1126  return (a - b);
1127 }
1128 template <>
1130  return (a * b);
1131 }
1132 template <>
1134  return (a / b);
1135 }
1136 template <>
1137 EIGEN_STRONG_INLINE Packet4f pnegate<Packet4f>(const Packet4f& a) {
1138  return (-a);
1139 }
1140 template <>
1141 EIGEN_STRONG_INLINE Packet4f pconj<Packet4f>(const Packet4f& a) {
1142  return a;
1143 }
1144 template <>
1145 EIGEN_STRONG_INLINE Packet4f pmadd<Packet4f>(const Packet4f& a, const Packet4f& b, const Packet4f& c) {
1146  return vec_madd(a, b, c);
1147 }
1148 template <>
1150  return vec_min(a, b);
1151 }
1152 template <>
1154  return vec_max(a, b);
1155 }
1156 template <>
1158  return vec_and(a, b);
1159 }
1160 template <>
1162  return vec_or(a, b);
1163 }
1164 template <>
1166  return vec_xor(a, b);
1167 }
1168 template <>
1170  return vec_and(a, vec_nor(b, b));
1171 }
1172 template <>
1174  return vec_round(a);
1175 }
1176 template <>
1178  return vec_ceil(a);
1179 }
1180 template <>
1182  return vec_floor(a);
1183 }
1184 template <>
1186  return vec_abs(a);
1187 }
1188 template <>
1190  EIGEN_ALIGN16 float x[4];
1191  pstore(x, a);
1192  return x[0];
1193 }
1194 
1195 template <>
1196 EIGEN_STRONG_INLINE Packet4f ploaddup<Packet4f>(const float* from) {
1197  Packet4f p = pload<Packet4f>(from);
1198  return vec_perm(p, p, p16uc_DUPLICATE32_HI);
1199 }
1200 
1201 template <>
1203  return reinterpret_cast<Packet4f>(
1204  vec_perm(reinterpret_cast<Packet16uc>(a), reinterpret_cast<Packet16uc>(a), p16uc_REVERSE32));
1205 }
1206 
1207 template <>
1209  Packet4f b, sum;
1210  b = vec_sld(a, a, 8);
1211  sum = padd<Packet4f>(a, b);
1212  b = vec_sld(sum, sum, 4);
1213  sum = padd<Packet4f>(sum, b);
1214  return pfirst(sum);
1215 }
1216 
1217 // Other reduction functions:
1218 // mul
1219 template <>
1221  Packet4f prod;
1222  prod = pmul(a, vec_sld(a, a, 8));
1223  return pfirst(pmul(prod, vec_sld(prod, prod, 4)));
1224 }
1225 
1226 // min
1227 template <>
1229  Packet4f b, res;
1230  b = pmin<Packet4f>(a, vec_sld(a, a, 8));
1231  res = pmin<Packet4f>(b, vec_sld(b, b, 4));
1232  return pfirst(res);
1233 }
1234 
1235 // max
1236 template <>
1238  Packet4f b, res;
1239  b = pmax<Packet4f>(a, vec_sld(a, a, 8));
1240  res = pmax<Packet4f>(b, vec_sld(b, b, 4));
1241  return pfirst(res);
1242 }
1243 
1244 EIGEN_DEVICE_FUNC inline void ptranspose(PacketBlock<Packet4f, 4>& kernel) {
1245  Packet4f t0 = vec_mergeh(kernel.packet[0], kernel.packet[2]);
1246  Packet4f t1 = vec_mergel(kernel.packet[0], kernel.packet[2]);
1247  Packet4f t2 = vec_mergeh(kernel.packet[1], kernel.packet[3]);
1248  Packet4f t3 = vec_mergel(kernel.packet[1], kernel.packet[3]);
1249  kernel.packet[0] = vec_mergeh(t0, t2);
1250  kernel.packet[1] = vec_mergel(t0, t2);
1251  kernel.packet[2] = vec_mergeh(t1, t3);
1252  kernel.packet[3] = vec_mergel(t1, t3);
1253 }
1254 
1255 template <>
1256 EIGEN_STRONG_INLINE Packet4f pblend(const Selector<4>& ifPacket, const Packet4f& thenPacket,
1257  const Packet4f& elsePacket) {
1258  Packet4ui select = {ifPacket.select[0], ifPacket.select[1], ifPacket.select[2], ifPacket.select[3]};
1259  Packet4ui mask = vec_cmpeq(select, reinterpret_cast<Packet4ui>(p4i_ONE));
1260  return vec_sel(elsePacket, thenPacket, mask);
1261 }
1262 
1263 #endif
1264 
1265 template <>
1266 EIGEN_STRONG_INLINE void prefetch<float>(const float* addr) {
1267  EIGEN_ZVECTOR_PREFETCH(addr);
1268 }
1269 template <>
1270 EIGEN_STRONG_INLINE Packet4f ploadu<Packet4f>(const float* from) {
1271  return pload<Packet4f>(from);
1272 }
1273 template <>
1274 EIGEN_STRONG_INLINE void pstoreu<float>(float* to, const Packet4f& from) {
1275  pstore<float>(to, from);
1276 }
1277 template <>
1280 }
1281 
1282 } // end namespace internal
1283 
1284 } // end namespace Eigen
1285 
1286 #endif // EIGEN_PACKET_MATH_ZVECTOR_H
Array< int, Dynamic, 1 > v
Definition: Array_initializer_list_vector_cxx11.cpp:1
int i
Definition: BiCGSTAB_step_by_step.cpp:9
#define EIGEN_ALIGN16
Definition: ConfigureVectorization.h:142
#define EIGEN_DEBUG_ALIGNED_STORE
Definition: GenericPacketMath.h:38
#define EIGEN_DEBUG_ALIGNED_LOAD
Definition: GenericPacketMath.h:30
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:892
#define EIGEN_STRONG_INLINE
Definition: Macros.h:834
cout<< "Here is the matrix m:"<< endl<< m<< endl;Matrix< ptrdiff_t, 3, 1 > res
Definition: PartialRedux_count.cpp:3
float * p
Definition: Tutorial_Map_using.cpp:9
#define EIGEN_ZVECTOR_PREFETCH(ADDR)
Definition: ZVector/PacketMath.h:154
Scalar * b
Definition: benchVecAdd.cpp:17
internal::packet_traits< Scalar >::type Packet
Definition: benchmark-blocking-sizes.cpp:54
static int f(const TensorMap< Tensor< int, 3 > > &tensor)
Definition: cxx11_tensor_map.cpp:237
@ Aligned16
Definition: Constants.h:237
RealScalar s
Definition: level1_cplx_impl.h:130
return int(ret)+1
const Scalar * a
Definition: level2_cplx_impl.h:32
EIGEN_STRONG_INLINE Packet4f pandnot< Packet4f >(const Packet4f &a, const Packet4f &b)
Definition: AltiVec/PacketMath.h:1465
static Packet16uc p16uc_REVERSE64
Definition: ZVector/PacketMath.h:125
std::ostream & operator<<(std::ostream &s, const Packet16c &v)
Definition: AltiVec/PacketMath.h:427
__m128d Packet2d
Definition: LSX/PacketMath.h:36
EIGEN_STRONG_INLINE void pstoreu< double >(double *to, const Packet4d &from)
Definition: AVX/PacketMath.h:1628
EIGEN_STRONG_INLINE Packet4f vec_splat_packet4f(const Packet4f &from)
Definition: ZVector/PacketMath.h:732
EIGEN_STRONG_INLINE double predux< Packet2d >(const Packet2d &a)
Definition: LSX/PacketMath.h:1965
EIGEN_STRONG_INLINE Packet2cf pconj(const Packet2cf &a)
Definition: AltiVec/Complex.h:268
eigen_packet_wrapper< __m128i, 3 > Packet2l
Definition: LSX/PacketMath.h:41
EIGEN_STRONG_INLINE Packet4f pmin< Packet4f >(const Packet4f &a, const Packet4f &b)
Definition: AltiVec/PacketMath.h:1250
EIGEN_STRONG_INLINE Packet2d padd< Packet2d >(const Packet2d &a, const Packet2d &b)
Definition: LSX/PacketMath.h:605
static Packet4i p4i_COUNTDOWN
Definition: AltiVec/PacketMath.h:88
EIGEN_STRONG_INLINE Packet2d pandnot< Packet2d >(const Packet2d &a, const Packet2d &b)
Definition: LSX/PacketMath.h:1003
__vector int Packet4i
Definition: AltiVec/PacketMath.h:34
EIGEN_STRONG_INLINE Packet4i pabs< Packet4i >(const Packet4i &a)
Definition: ZVector/PacketMath.h:619
EIGEN_STRONG_INLINE Packet4f padd< Packet4f >(const Packet4f &a, const Packet4f &b)
Definition: AltiVec/PacketMath.h:1066
EIGEN_STRONG_INLINE Packet4i por< Packet4i >(const Packet4i &a, const Packet4i &b)
Definition: AltiVec/PacketMath.h:1431
EIGEN_STRONG_INLINE Packet4f pcmp_eq< Packet4f >(const Packet4f &a, const Packet4f &b)
Definition: LSX/PacketMath.h:1131
static EIGEN_DECLARE_CONST_FAST_Packet4f(ZERO, 0)
static EIGEN_DECLARE_CONST_FAST_Packet2d(ZERO, 0)
__vector unsigned char Packet16uc
Definition: AltiVec/PacketMath.h:41
EIGEN_STRONG_INLINE Packet4i pset1< Packet4i >(const int &from)
Definition: AltiVec/PacketMath.h:778
EIGEN_STRONG_INLINE Packet4f pabs< Packet4f >(const Packet4f &a)
Definition: ZVector/PacketMath.h:954
EIGEN_STRONG_INLINE Packet4f pcmp_le< Packet4f >(const Packet4f &a, const Packet4f &b)
Definition: LSX/PacketMath.h:1040
EIGEN_STRONG_INLINE float pfirst< Packet4f >(const Packet4f &a)
Definition: AltiVec/PacketMath.h:1863
EIGEN_STRONG_INLINE Packet2d pand< Packet2d >(const Packet2d &a, const Packet2d &b)
Definition: LSX/PacketMath.h:880
EIGEN_STRONG_INLINE void ptranspose(PacketBlock< Packet2cf, 2 > &kernel)
Definition: AltiVec/Complex.h:339
EIGEN_STRONG_INLINE Packet4i ploaddup< Packet4i >(const int *from)
Definition: AltiVec/PacketMath.h:1644
static Packet16uc p16uc_TRANSPOSE64_LO
Definition: AltiVec/PacketMath.h:145
EIGEN_STRONG_INLINE float predux_max< Packet4f >(const Packet4f &a)
Definition: AltiVec/PacketMath.h:2679
EIGEN_STRONG_INLINE Packet2d ploaddup< Packet2d >(const double *from)
Definition: LSX/PacketMath.h:1490
static Packet16uc p16uc_REVERSE32
Definition: AltiVec/PacketMath.h:95
EIGEN_STRONG_INLINE Packet2d pxor< Packet2d >(const Packet2d &a, const Packet2d &b)
Definition: LSX/PacketMath.h:962
EIGEN_STRONG_INLINE Packet2d por< Packet2d >(const Packet2d &a, const Packet2d &b)
Definition: LSX/PacketMath.h:921
EIGEN_STRONG_INLINE Packet4i pdiv< Packet4i >(const Packet4i &a, const Packet4i &b)
Definition: AltiVec/PacketMath.h:1205
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void pscatter< int, Packet4i >(int *to, const Packet4i &from, Index stride)
Definition: AltiVec/PacketMath.h:959
EIGEN_STRONG_INLINE Packet4f ploaddup< Packet4f >(const float *from)
Definition: AltiVec/PacketMath.h:1640
EIGEN_STRONG_INLINE Packet4f por< Packet4f >(const Packet4f &a, const Packet4f &b)
Definition: AltiVec/PacketMath.h:1427
EIGEN_STRONG_INLINE int predux_min< Packet4i >(const Packet4i &a)
Definition: AltiVec/PacketMath.h:2604
EIGEN_STRONG_INLINE Packet4i pxor< Packet4i >(const Packet4i &a, const Packet4i &b)
Definition: AltiVec/PacketMath.h:1452
EIGEN_STRONG_INLINE double predux_max< Packet2d >(const Packet2d &a)
Definition: LSX/PacketMath.h:2127
EIGEN_STRONG_INLINE Packet4f pmul< Packet4f >(const Packet4f &a, const Packet4f &b)
Definition: AltiVec/PacketMath.h:1162
static Packet16uc p16uc_PSET32_WEVEN
Definition: AltiVec/PacketMath.h:132
EIGEN_DEVICE_FUNC Packet pmax(const Packet &a, const Packet &b)
Definition: GenericPacketMath.h:663
EIGEN_STRONG_INLINE Packet4i pblend(const Selector< 4 > &ifPacket, const Packet4i &thenPacket, const Packet4i &elsePacket)
Definition: AltiVec/PacketMath.h:3075
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Packet4f pgather< float, Packet4f >(const float *from, Index stride)
Definition: AltiVec/PacketMath.h:853
EIGEN_STRONG_INLINE Packet4f pcmp_le(const Packet4f &a, const Packet4f &b)
Definition: AltiVec/PacketMath.h:1314
EIGEN_STRONG_INLINE Packet2d pset1< Packet2d >(const double &from)
Definition: LSX/PacketMath.h:503
EIGEN_STRONG_INLINE Packet4f pload< Packet4f >(const float *from)
Definition: AltiVec/PacketMath.h:492
EIGEN_STRONG_INLINE int predux_mul< Packet4i >(const Packet4i &a)
Definition: AltiVec/PacketMath.h:2529
EIGEN_STRONG_INLINE void pstore< int >(int *to, const Packet4i &from)
Definition: AltiVec/PacketMath.h:647
EIGEN_STRONG_INLINE Packet8h por(const Packet8h &a, const Packet8h &b)
Definition: AVX/PacketMath.h:2309
EIGEN_STRONG_INLINE Packet4i pcmp_lt(const Packet4i &a, const Packet4i &b)
Definition: AltiVec/PacketMath.h:1341
static EIGEN_DECLARE_CONST_FAST_Packet2l(ZERO, 0)
__vector unsigned int Packet4ui
Definition: AltiVec/PacketMath.h:35
EIGEN_STRONG_INLINE Packet2cf preverse(const Packet2cf &a)
Definition: AltiVec/Complex.h:303
__vector __bool int Packet4bi
Definition: AltiVec/PacketMath.h:36
EIGEN_STRONG_INLINE void pstore< double >(double *to, const Packet4d &from)
Definition: AVX/PacketMath.h:1611
EIGEN_STRONG_INLINE Packet4i padd< Packet4i >(const Packet4i &a, const Packet4i &b)
Definition: AltiVec/PacketMath.h:1070
EIGEN_STRONG_INLINE Packet4f pfloor< Packet4f >(const Packet4f &a)
Definition: AltiVec/PacketMath.h:1497
EIGEN_STRONG_INLINE Packet4f pmadd(const Packet4f &a, const Packet4f &b, const Packet4f &c)
Definition: AltiVec/PacketMath.h:1218
EIGEN_STRONG_INLINE Packet4cf pmul(const Packet4cf &a, const Packet4cf &b)
Definition: AVX/Complex.h:88
EIGEN_STRONG_INLINE Packet4i pandnot< Packet4i >(const Packet4i &a, const Packet4i &b)
Definition: AltiVec/PacketMath.h:1469
EIGEN_DEVICE_FUNC Packet pmin(const Packet &a, const Packet &b)
Definition: GenericPacketMath.h:649
EIGEN_STRONG_INLINE Packet4f pdiv< Packet4f >(const Packet4f &a, const Packet4f &b)
Definition: AltiVec/PacketMath.h:1187
EIGEN_STRONG_INLINE Packet8h pandnot(const Packet8h &a, const Packet8h &b)
Definition: AVX/PacketMath.h:2323
EIGEN_STRONG_INLINE Packet2d pload< Packet2d >(const double *from)
Definition: LSX/PacketMath.h:1407
EIGEN_STRONG_INLINE Packet2d pmul< Packet2d >(const Packet2d &a, const Packet2d &b)
Definition: LSX/PacketMath.h:741
EIGEN_STRONG_INLINE Packet2cf pnegate(const Packet2cf &a)
Definition: AltiVec/Complex.h:264
EIGEN_STRONG_INLINE float predux_mul< Packet4f >(const Packet4f &a)
Definition: AltiVec/PacketMath.h:2522
EIGEN_STRONG_INLINE void prefetch< float >(const float *addr)
Definition: AltiVec/PacketMath.h:1854
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void pscatter< double, Packet2d >(double *to, const Packet2d &from, Index stride)
Definition: LSX/PacketMath.h:1734
EIGEN_STRONG_INLINE Packet4i ploadu< Packet4i >(const int *from)
Definition: AltiVec/PacketMath.h:1537
EIGEN_STRONG_INLINE double predux_mul< Packet2d >(const Packet2d &a)
Definition: LSX/PacketMath.h:2019
EIGEN_STRONG_INLINE Packet2d pdiv< Packet2d >(const Packet2d &a, const Packet2d &b)
Definition: LSX/PacketMath.h:782
static Packet4f p4f_MZERO
Definition: AltiVec/PacketMath.h:81
EIGEN_STRONG_INLINE double predux_min< Packet2d >(const Packet2d &a)
Definition: LSX/PacketMath.h:2073
EIGEN_STRONG_INLINE Packet4f pset1< Packet4f >(const float &from)
Definition: AltiVec/PacketMath.h:773
static Packet2d p2d_ZERO_
Definition: ZVector/PacketMath.h:91
EIGEN_STRONG_INLINE Packet4i psub< Packet4i >(const Packet4i &a, const Packet4i &b)
Definition: AltiVec/PacketMath.h:1099
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void pscatter< float, Packet4f >(float *to, const Packet4f &from, Index stride)
Definition: AltiVec/PacketMath.h:954
EIGEN_STRONG_INLINE Packet2d plset< Packet2d >(const double &a)
Definition: LSX/PacketMath.h:563
EIGEN_STRONG_INLINE Packet4f pceil< Packet4f >(const Packet4f &a)
Definition: AltiVec/PacketMath.h:1493
EIGEN_STRONG_INLINE void pstore< float >(float *to, const Packet4f &from)
Definition: AltiVec/PacketMath.h:642
EIGEN_STRONG_INLINE Packet4f pabs(const Packet4f &a)
Definition: AltiVec/PacketMath.h:1936
static EIGEN_DECLARE_CONST_FAST_Packet4i(ZERO, 0)
static Packet2d p2d_ONE
Definition: ZVector/PacketMath.h:90
EIGEN_STRONG_INLINE bfloat16 pfirst(const Packet8bf &a)
Definition: AltiVec/PacketMath.h:2418
EIGEN_STRONG_INLINE void pbroadcast4< Packet2d >(const double *a, Packet2d &a0, Packet2d &a1, Packet2d &a2, Packet2d &a3)
Definition: SSE/PacketMath.h:1819
eigen_packet_wrapper< __m256i, 0 > Packet8i
Definition: AVX/PacketMath.h:35
EIGEN_DEVICE_FUNC void pstore(Scalar *to, const Packet &from)
Definition: GenericPacketMath.h:891
static Packet16uc p16uc_PSET64_HI
Definition: AltiVec/PacketMath.h:139
EIGEN_STRONG_INLINE Packet2d ploadu< Packet2d >(const double *from)
Definition: LSX/PacketMath.h:1448
EIGEN_STRONG_INLINE Packet4f pcmp_lt< Packet4f >(const Packet4f &a, const Packet4f &b)
Definition: LSX/PacketMath.h:1081
EIGEN_STRONG_INLINE Packet4f pxor< Packet4f >(const Packet4f &a, const Packet4f &b)
Definition: AltiVec/PacketMath.h:1448
EIGEN_STRONG_INLINE Packet4i pmin< Packet4i >(const Packet4i &a, const Packet4i &b)
Definition: AltiVec/PacketMath.h:1261
EIGEN_STRONG_INLINE Packet2d pabs< Packet2d >(const Packet2d &a)
Definition: ZVector/PacketMath.h:623
EIGEN_STRONG_INLINE Packet2cf pcmp_eq(const Packet2cf &a, const Packet2cf &b)
Definition: AltiVec/Complex.h:353
static Packet16uc p16uc_FORWARD
Definition: AltiVec/PacketMath.h:128
EIGEN_STRONG_INLINE void pstoreu< int >(int *to, const Packet4i &from)
Definition: AltiVec/PacketMath.h:1760
EIGEN_STRONG_INLINE Packet8h pand(const Packet8h &a, const Packet8h &b)
Definition: AVX/PacketMath.h:2319
EIGEN_STRONG_INLINE Packet8h pxor(const Packet8h &a, const Packet8h &b)
Definition: AVX/PacketMath.h:2315
EIGEN_STRONG_INLINE int pfirst< Packet4i >(const Packet4i &a)
Definition: AltiVec/PacketMath.h:1869
EIGEN_STRONG_INLINE Packet4i plset< Packet4i >(const int &a)
Definition: AltiVec/PacketMath.h:1045
EIGEN_STRONG_INLINE float predux< Packet4f >(const Packet4f &a)
Definition: AltiVec/PacketMath.h:2435
EIGEN_STRONG_INLINE Packet2d pceil< Packet2d >(const Packet2d &a)
Definition: MSA/PacketMath.h:1186
EIGEN_STRONG_INLINE Packet4f ploadu< Packet4f >(const float *from)
Definition: AltiVec/PacketMath.h:1533
EIGEN_STRONG_INLINE Packet4i pmul< Packet4i >(const Packet4i &a, const Packet4i &b)
Definition: AltiVec/PacketMath.h:1166
EIGEN_STRONG_INLINE Packet4i pand< Packet4i >(const Packet4i &a, const Packet4i &b)
Definition: AltiVec/PacketMath.h:1410
EIGEN_STRONG_INLINE Packet2d pmin< Packet2d >(const Packet2d &a, const Packet2d &b)
Definition: LSX/PacketMath.h:1244
EIGEN_STRONG_INLINE int predux< Packet4i >(const Packet4i &a)
Definition: AltiVec/PacketMath.h:2445
static Packet2d p2d_COUNTDOWN
Definition: ZVector/PacketMath.h:109
EIGEN_STRONG_INLINE Packet4f pand< Packet4f >(const Packet4f &a, const Packet4f &b)
Definition: AltiVec/PacketMath.h:1406
static Packet16uc p16uc_PSET32_WODD
Definition: AltiVec/PacketMath.h:129
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Packet4i pgather< int, Packet4i >(const int *from, Index stride)
Definition: AltiVec/PacketMath.h:858
static Packet16uc p16uc_PSET64_LO
Definition: AltiVec/PacketMath.h:141
EIGEN_STRONG_INLINE int predux_max< Packet4i >(const Packet4i &a)
Definition: AltiVec/PacketMath.h:2684
static Packet16uc p16uc_COMPLEX32_REV
Definition: AltiVec/PacketMath.h:148
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet2d pgather< double, Packet2d >(const double *from, Index stride)
Definition: LSX/PacketMath.h:1621
EIGEN_STRONG_INLINE Packet4i pmax< Packet4i >(const Packet4i &a, const Packet4i &b)
Definition: AltiVec/PacketMath.h:1293
EIGEN_STRONG_INLINE void pbroadcast4< Packet4f >(const float *a, Packet4f &a0, Packet4f &a1, Packet4f &a2, Packet4f &a3)
Definition: AltiVec/PacketMath.h:823
EIGEN_STRONG_INLINE Packet4i pload< Packet4i >(const int *from)
Definition: AltiVec/PacketMath.h:497
__vector float Packet4f
Definition: AltiVec/PacketMath.h:33
EIGEN_STRONG_INLINE Packet2d psub< Packet2d >(const Packet2d &a, const Packet2d &b)
Definition: LSX/PacketMath.h:646
EIGEN_STRONG_INLINE Packet4f psub< Packet4f >(const Packet4f &a, const Packet4f &b)
Definition: AltiVec/PacketMath.h:1095
static Packet4f p4f_COUNTDOWN
Definition: AltiVec/PacketMath.h:87
EIGEN_STRONG_INLINE Packet4f plset< Packet4f >(const float &a)
Definition: AltiVec/PacketMath.h:1041
EIGEN_STRONG_INLINE void pstoreu< float >(float *to, const Packet4f &from)
Definition: AltiVec/PacketMath.h:1756
EIGEN_STRONG_INLINE Packet2d pmax< Packet2d >(const Packet2d &a, const Packet2d &b)
Definition: LSX/PacketMath.h:1256
EIGEN_STRONG_INLINE Packet4f pround< Packet4f >(const Packet4f &a)
Definition: AltiVec/PacketMath.h:1479
static Packet16uc p16uc_COMPLEX32_REV2
Definition: ZVector/PacketMath.h:148
EIGEN_STRONG_INLINE Packet2d pround< Packet2d >(const Packet2d &a)
Definition: MSA/PacketMath.h:1206
EIGEN_STRONG_INLINE void prefetch< int >(const int *addr)
Definition: AltiVec/PacketMath.h:1858
EIGEN_STRONG_INLINE double pfirst< Packet2d >(const Packet2d &a)
Definition: LSX/PacketMath.h:1879
eigen_packet_wrapper< __m128i, 7 > Packet2ul
Definition: LSX/PacketMath.h:45
EIGEN_DEVICE_FUNC unpacket_traits< Packet >::type predux_mul(const Packet &a)
Definition: GenericPacketMath.h:1238
EIGEN_STRONG_INLINE Packet2d pfloor< Packet2d >(const Packet2d &a)
Definition: MSA/PacketMath.h:1167
EIGEN_STRONG_INLINE void pbroadcast4< Packet4i >(const int *a, Packet4i &a0, Packet4i &a1, Packet4i &a2, Packet4i &a3)
Definition: AltiVec/PacketMath.h:827
EIGEN_STRONG_INLINE float predux_min< Packet4f >(const Packet4f &a)
Definition: AltiVec/PacketMath.h:2599
EIGEN_STRONG_INLINE void prefetch< double >(const double *addr)
Definition: AVX/PacketMath.h:1750
static Packet16uc p16uc_DUPLICATE32_HI
Definition: ZVector/PacketMath.h:113
EIGEN_STRONG_INLINE Packet4f pmax< Packet4f >(const Packet4f &a, const Packet4f &b)
Definition: AltiVec/PacketMath.h:1282
static Packet16uc p16uc_TRANSPOSE64_HI
Definition: AltiVec/PacketMath.h:143
std::int32_t int32_t
Definition: Meta.h:41
std::int64_t int64_t
Definition: Meta.h:43
std::uint32_t uint32_t
Definition: Meta.h:40
std::uint64_t uint64_t
Definition: Meta.h:42
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:70
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:83
const Product< Lhs, Rhs > prod(const Lhs &lhs, const Rhs &rhs)
Definition: evaluators.cpp:7
int c
Definition: calibrate.py:100
Definition: Eigen_Colamd.h:49
list x
Definition: plotDoE.py:28
Definition: GenericPacketMath.h:1407
@ HasRsqrt
Definition: GenericPacketMath.h:74
@ HasSin
Definition: GenericPacketMath.h:81
@ HasBlend
Definition: GenericPacketMath.h:66
@ HasCos
Definition: GenericPacketMath.h:82
@ HasExp
Definition: GenericPacketMath.h:75
@ HasSqrt
Definition: GenericPacketMath.h:73
@ HasErf
Definition: GenericPacketMath.h:95
@ HasLog
Definition: GenericPacketMath.h:77
@ HasTanh
Definition: GenericPacketMath.h:90
@ HasDiv
Definition: GenericPacketMath.h:71
Packet2d half
Definition: ZVector/PacketMath.h:206
Packet2d type
Definition: ZVector/PacketMath.h:205
Packet4f type
Definition: ZVector/PacketMath.h:176
Packet4f half
Definition: ZVector/PacketMath.h:177
Packet4i type
Definition: ZVector/PacketMath.h:159
Packet4i half
Definition: ZVector/PacketMath.h:160
@ size
Definition: GenericPacketMath.h:113
@ AlignedOnScalar
Definition: GenericPacketMath.h:114
@ Vectorizable
Definition: GenericPacketMath.h:112
@ HasSub
Definition: GenericPacketMath.h:118
@ HasMax
Definition: GenericPacketMath.h:124
@ HasNegate
Definition: GenericPacketMath.h:120
@ HasMul
Definition: GenericPacketMath.h:119
@ HasAdd
Definition: GenericPacketMath.h:117
@ HasMin
Definition: GenericPacketMath.h:123
@ HasAbs
Definition: GenericPacketMath.h:121
double type
Definition: ZVector/PacketMath.h:256
Packet2d half
Definition: ZVector/PacketMath.h:264
Packet4f half
Definition: ZVector/PacketMath.h:252
float type
Definition: ZVector/PacketMath.h:244
int type
Definition: ZVector/PacketMath.h:232
Packet4i half
Definition: ZVector/PacketMath.h:240
Definition: GenericPacketMath.h:134
@ masked_load_available
Definition: GenericPacketMath.h:142
@ size
Definition: GenericPacketMath.h:139
@ masked_store_available
Definition: GenericPacketMath.h:143
@ vectorizable
Definition: GenericPacketMath.h:141
@ alignment
Definition: GenericPacketMath.h:140
Definition: ZVector/PacketMath.h:50
numext::int32_t i[4]
Definition: ZVector/PacketMath.h:51
Packet4f v4f
Definition: ZVector/PacketMath.h:63
Packet2ul v2ul
Definition: ZVector/PacketMath.h:60
Packet4i v4i
Definition: ZVector/PacketMath.h:57
Packet4ui v4ui
Definition: ZVector/PacketMath.h:58
Packet2l v2l
Definition: ZVector/PacketMath.h:59
Packet2d v2d
Definition: ZVector/PacketMath.h:61