IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
MaskCastPack.h
Go to the documentation of this file.
1 // MaskCastPack.h:
3 // ------------
4 //
14 
15 #ifndef __IPSDKUTIL_INSTRUCTIONSET_DETAIL_AVX512_MASKCASTPACK_H__
16 #define __IPSDKUTIL_INSTRUCTIONSET_DETAIL_AVX512_MASKCASTPACK_H__
17 
27 
28 #include <boost/type_traits/is_same.hpp>
29 #include <boost/type_traits/is_signed.hpp>
30 
31 namespace ipsdk {
32 namespace simd {
33 namespace detail {
34 
37 
38 template <typename TIn, typename TOut>
39 struct MaskCastPack<
41  TIn,
42  TOut,
43  typename boost::enable_if<
44  typename boost::mpl::and_<
45  typename boost::mpl::equal_to<
46  boost::mpl::sizeof_<TIn>,
47  boost::mpl::int_<1>
48  >::type,
49  typename boost::mpl::equal_to<
50  boost::mpl::sizeof_<TOut>,
51  boost::mpl::int_<1>
52  >::type
53  >::type
54  >::type
55 >
56 {
58  IPSDK_FORCEINLINE
60  {
62  act(in, out);
63  return out;
64  }
65 
66  static
67  IPSDK_FORCEINLINE
68  void
71  {
73  }
74 };
75 
76 template <typename TIn, typename TOut>
77 struct MaskCastPack<
79  TIn,
80  TOut,
81  typename boost::enable_if<
82  typename boost::mpl::and_<
83  typename boost::mpl::equal_to<
84  boost::mpl::sizeof_<TIn>,
85  boost::mpl::int_<2>
86  >::type,
87  typename boost::mpl::equal_to<
88  boost::mpl::sizeof_<TOut>,
89  boost::mpl::int_<2>
90  >::type
91  >::type
92  >::type
93 >
94 {
96  IPSDK_FORCEINLINE
98  {
100  act(in, out);
101  return out;
102  }
103 
104  static
105  IPSDK_FORCEINLINE
106  void
109  {
112  }
113 };
114 
115 template <typename TIn, typename TOut>
118  TIn,
119  TOut,
120  typename boost::enable_if<
121  typename boost::mpl::and_<
122  typename boost::mpl::equal_to<
123  boost::mpl::sizeof_<TIn>,
124  boost::mpl::int_<4>
125  >::type,
126  typename boost::mpl::equal_to<
127  boost::mpl::sizeof_<TOut>,
128  boost::mpl::int_<4>
129  >::type
130  >::type
131  >::type
132 >
133 {
135  IPSDK_FORCEINLINE
137  {
139  act(in, out);
140  return out;
141  }
142 
143  static
144  IPSDK_FORCEINLINE
145  void
148  {
153  }
154 };
155 
156 template <typename TIn, typename TOut>
159  TIn,
160  TOut,
161  typename boost::enable_if<
162  typename boost::mpl::and_<
163  typename boost::mpl::equal_to<
164  boost::mpl::sizeof_<TIn>,
165  boost::mpl::int_<8>
166  >::type,
167  typename boost::mpl::equal_to<
168  boost::mpl::sizeof_<TOut>,
169  boost::mpl::int_<8>
170  >::type
171  >::type
172  >::type
173 >
174 {
176  IPSDK_FORCEINLINE
178  {
180  act(in, out);
181  return out;
182  }
183 
184  static
185  IPSDK_FORCEINLINE
186  void
189  {
198  }
199 };
200 
201 template <typename TIn, typename TOut>
204  TIn,
205  TOut,
206  typename boost::enable_if<
207  typename boost::mpl::and_<
208  typename boost::mpl::equal_to<
209  boost::mpl::sizeof_<TIn>,
210  boost::mpl::int_<1>
211  >::type,
212  typename boost::mpl::equal_to<
213  boost::mpl::sizeof_<TOut>,
214  boost::mpl::int_<2>
215  >::type
216  >::type
217  >::type
218 >
219 {
220  static IPSDK_FORCEINLINE
223  {
225  act(in, out);
226  return out;
227  }
228 
229  static
230  IPSDK_FORCEINLINE
231  void
234  {
235  MaskCastReg<eInstructionSet::eIS_Avx512, TIn, TOut>::act(in._val[0], out._val[0], out._val[1]);
236  }
237 };
238 
239 template <typename TIn, typename TOut>
242  TIn,
243  TOut,
244  typename boost::enable_if<
245  typename boost::mpl::and_<
246  typename boost::mpl::equal_to<
247  boost::mpl::sizeof_<TIn>,
248  boost::mpl::int_<1>
249  >::type,
250  typename boost::mpl::equal_to<
251  boost::mpl::sizeof_<TOut>,
252  boost::mpl::int_<4>
253  >::type
254  >::type
255  >::type
256 >
257 {
258  static IPSDK_FORCEINLINE
261  {
263  act(in, out);
264  return out;
265  }
266 
267  static
268  IPSDK_FORCEINLINE
269  void
272  {
274  in._val[0], out._val[0], out._val[1], out._val[2], out._val[3]);
275  }
276 };
277 
278 template <typename TIn, typename TOut>
281  TIn,
282  TOut,
283  typename boost::enable_if<
284  typename boost::mpl::and_<
285  typename boost::mpl::equal_to<
286  boost::mpl::sizeof_<TIn>,
287  boost::mpl::int_<1>
288  >::type,
289  typename boost::mpl::equal_to<
290  boost::mpl::sizeof_<TOut>,
291  boost::mpl::int_<8>
292  >::type
293  >::type
294  >::type
295 >
296 {
297  static IPSDK_FORCEINLINE
300  {
302  act(in, out);
303  return out;
304  }
305 
306  static
307  IPSDK_FORCEINLINE
308  void
311  {
313  in._val[0],
314  out._val[0],
315  out._val[1],
316  out._val[2],
317  out._val[3],
318  out._val[4],
319  out._val[5],
320  out._val[6],
321  out._val[7]);
322  }
323 };
324 
325 template <typename TIn, typename TOut>
328  TIn,
329  TOut,
330  typename boost::enable_if<
331  typename boost::mpl::and_<
332  typename boost::mpl::equal_to<
333  boost::mpl::sizeof_<TIn>,
334  boost::mpl::int_<2>
335  >::type,
336  typename boost::mpl::equal_to<
337  boost::mpl::sizeof_<TOut>,
338  boost::mpl::int_<4>
339  >::type
340  >::type
341  >::type
342 >
343 {
344  static IPSDK_FORCEINLINE
347  {
349  act(in, out);
350  return out;
351  }
352 
353  static
354  IPSDK_FORCEINLINE
355  void
358  {
360  in._val[0],
361  out._val[0],
362  out._val[1]);
364  in._val[1],
365  out._val[2],
366  out._val[3]);
367  }
368 };
369 
370 template <typename TIn, typename TOut>
373  TIn,
374  TOut,
375  typename boost::enable_if<
376  typename boost::mpl::and_<
377  typename boost::mpl::equal_to<
378  boost::mpl::sizeof_<TIn>,
379  boost::mpl::int_<2>
380  >::type,
381  typename boost::mpl::equal_to<
382  boost::mpl::sizeof_<TOut>,
383  boost::mpl::int_<8>
384  >::type
385  >::type
386  >::type
387 >
388 {
389  static IPSDK_FORCEINLINE
392  {
394  act(in, out);
395  return out;
396  }
397 
398  static
399  IPSDK_FORCEINLINE
400  void
403  {
405  in._val[0],
406  out._val[0],
407  out._val[1],
408  out._val[2],
409  out._val[3]);
411  in._val[1],
412  out._val[4],
413  out._val[5],
414  out._val[6],
415  out._val[7]);
416  }
417 };
418 
419 template <typename TIn, typename TOut>
422  TIn,
423  TOut,
424  typename boost::enable_if<
425  typename boost::mpl::and_<
426  typename boost::mpl::equal_to<
427  boost::mpl::sizeof_<TIn>,
428  boost::mpl::int_<4>
429  >::type,
430  typename boost::mpl::equal_to<
431  boost::mpl::sizeof_<TOut>,
432  boost::mpl::int_<8>
433  >::type
434  >::type
435  >::type
436 >
437 {
438  static IPSDK_FORCEINLINE
441  {
443  act(in, out);
444  return out;
445  }
446 
447  static
448  IPSDK_FORCEINLINE
449  void
452  {
454  in._val[0],
455  out._val[0],
456  out._val[1]);
458  in._val[1],
459  out._val[2],
460  out._val[3]);
462  in._val[2],
463  out._val[4],
464  out._val[5]);
466  in._val[3],
467  out._val[6],
468  out._val[7]);
469  }
470 };
471 
472 template <typename TIn, typename TOut>
475  TIn,
476  TOut,
477  typename boost::enable_if<
478  typename boost::mpl::and_<
479  typename boost::mpl::equal_to<
480  boost::mpl::sizeof_<TIn>,
481  boost::mpl::int_<2>
482  >::type,
483  typename boost::mpl::equal_to<
484  boost::mpl::sizeof_<TOut>,
485  boost::mpl::int_<1>
486  >::type
487  >::type
488  >::type
489 >
490 {
491  static IPSDK_FORCEINLINE
494  {
496  act(in, out);
497  return out;
498  }
499 
500  static
501  IPSDK_FORCEINLINE
502  void
505  {
507  in._val[0], in._val[1], out._val[0]);
508  }
509 };
510 
511 template <typename TIn, typename TOut>
514  TIn,
515  TOut,
516  typename boost::enable_if<
517  typename boost::mpl::and_<
518  typename boost::mpl::equal_to<
519  boost::mpl::sizeof_<TIn>,
520  boost::mpl::int_<4>
521  >::type,
522  typename boost::mpl::equal_to<
523  boost::mpl::sizeof_<TOut>,
524  boost::mpl::int_<2>
525  >::type
526  >::type
527  >::type
528 >
529 {
530  static IPSDK_FORCEINLINE
533  {
535  act(in, out);
536  return out;
537  }
538 
539  static
540  IPSDK_FORCEINLINE
541  void
544  {
546  in._val[0], in._val[1], out._val[0]);
548  in._val[2], in._val[3], out._val[1]);
549  }
550 };
551 
552 template <typename TIn, typename TOut>
555  TIn,
556  TOut,
557  typename boost::enable_if<
558  typename boost::mpl::and_<
559  typename boost::mpl::equal_to<
560  boost::mpl::sizeof_<TIn>,
561  boost::mpl::int_<4>
562  >::type,
563  typename boost::mpl::equal_to<
564  boost::mpl::sizeof_<TOut>,
565  boost::mpl::int_<1>
566  >::type
567  >::type
568  >::type
569 >
570 {
571  static IPSDK_FORCEINLINE
574  {
576  act(in, out);
577  return out;
578  }
579 
580  static
581  IPSDK_FORCEINLINE
582  void
585  {
587  in._val[0], in._val[1], in._val[2], in._val[3], out._val[0]);
588  }
589 };
590 
591 template <typename TIn, typename TOut>
594  TIn,
595  TOut,
596  typename boost::enable_if<
597  typename boost::mpl::and_<
598  typename boost::mpl::equal_to<
599  boost::mpl::sizeof_<TIn>,
600  boost::mpl::int_<8>
601  >::type,
602  typename boost::mpl::equal_to<
603  boost::mpl::sizeof_<TOut>,
604  boost::mpl::int_<4>
605  >::type
606  >::type
607  >::type
608 >
609 {
610  static IPSDK_FORCEINLINE
613  {
615  act(in, out);
616  return out;
617  }
618 
619  static
620  IPSDK_FORCEINLINE
621  void
624  {
626  in._val[0], in._val[1], out._val[0]);
628  in._val[2], in._val[3], out._val[1]);
630  in._val[4], in._val[5], out._val[2]);
632  in._val[6], in._val[7], out._val[3]);
633  }
634 };
635 
636 template <typename TIn, typename TOut>
639  TIn,
640  TOut,
641  typename boost::enable_if<
642  typename boost::mpl::and_<
643  typename boost::mpl::equal_to<
644  boost::mpl::sizeof_<TIn>,
645  boost::mpl::int_<8>
646  >::type,
647  typename boost::mpl::equal_to<
648  boost::mpl::sizeof_<TOut>,
649  boost::mpl::int_<2>
650  >::type
651  >::type
652  >::type
653 >
654 {
655  static IPSDK_FORCEINLINE
658  {
660  act(in, out);
661  return out;
662  }
663 
664  static
665  IPSDK_FORCEINLINE
666  void
669  {
671  in._val[0], in._val[1], in._val[2], in._val[3], out._val[0]);
673  in._val[4], in._val[5], in._val[6], in._val[7], out._val[1]);
674  }
675 };
676 
677 template <typename TIn, typename TOut>
680  TIn,
681  TOut,
682  typename boost::enable_if<
683  typename boost::mpl::and_<
684  typename boost::mpl::equal_to<
685  boost::mpl::sizeof_<TIn>,
686  boost::mpl::int_<8>
687  >::type,
688  typename boost::mpl::equal_to<
689  boost::mpl::sizeof_<TOut>,
690  boost::mpl::int_<1>
691  >::type
692  >::type
693  >::type
694 >
695 {
696  static IPSDK_FORCEINLINE
699  {
701  act(in, out);
702  return out;
703  }
704 
705  static
706  IPSDK_FORCEINLINE
707  void
710  {
712  in._val[0],
713  in._val[1],
714  in._val[2],
715  in._val[3],
716  in._val[4],
717  in._val[5],
718  in._val[6],
719  in._val[7],
720  out._val[0]);
721  }
722 };
723 
726 
727 } // end of namespace detail
728 } // end of namespace simd
729 } // end of namespace ipsdk
730 
731 #endif // __IPSDKUTIL_INSTRUCTIONSET_DETAIL_AVX512_MASKCASTPACK_H__
Definition: MaskCastReg.h:30
Defines the IPSDK_FORCEINLINE.
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
structure containing set of masks for vectorized operations
Definition: BaseMaskPackDecl.h:29
BaseMaskPack class; defines a set of masks; the number of masks in this set depends on the type of th...
utility functions for array operations
(including fundation and byte and word instructions)
Definition: InstructionSetTypes.h:51
BasePack class; defines a set of scalars (for instruction set "standard") or registers (for all other...
template structures used for immediate type promotion
eInstructionSet
Enumerate for processor instruction set description.
Definition: InstructionSetTypes.h:31
function assigning a given value of type T to a given Pack<instructionSet, T>
Definition: MaskCastPack.h:33
Definition of import/export macro for library.
structure containing intrinsic registers used to store vectorized data
Definition: BasePackDecl.h:29