IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
MaskCastReg.h
Go to the documentation of this file.
1 // MaskCastReg.h:
3 // ------------
4 //
14 
15 #ifndef __IPSDKUTIL_INSTRUCTIONSET_DETAIL_SSE2_MASKCASTREG_H__
16 #define __IPSDKUTIL_INSTRUCTIONSET_DETAIL_SSE2_MASKCASTREG_H__
17 
24 
25 #include <boost/mpl/and.hpp>
26 #include <boost/mpl/equal_to.hpp>
27 #include <boost/mpl/int.hpp>
28 #include <boost/mpl/not.hpp>
29 #include <boost/mpl/or.hpp>
30 #include <boost/mpl/sizeof.hpp>
31 #include <boost/type_traits/is_signed.hpp>
32 
33 namespace ipsdk {
34 namespace simd {
35 namespace detail {
36 
39 
42 template <typename TIn, typename TOut>
43 struct MaskCastReg<
45  TIn,
46  TOut,
47  typename boost::enable_if<
48  typename boost::mpl::or_<
49  typename boost::is_same<TIn, TOut>::type,
50  typename boost::mpl::and_<
51  typename boost::is_integral<TIn>::type,
52  typename boost::mpl::and_<
53  typename boost::is_integral<TOut>::type,
54  typename boost::mpl::equal_to<
55  boost::mpl::sizeof_<TIn>,
56  boost::mpl::sizeof_<TOut>
57  >::type
58  >::type
59  >::type
60  >::type
61  >::type
62 >
63 {
64  static IPSDK_FORCEINLINE
65  void act(const typename RegMaskType<eInstructionSet::eIS_Sse2, TIn>::Type& in,
67  {
68  out = in;
69  }
70 };
71 
74 template <typename TIn, typename TOut>
75 struct MaskCastReg<
77  TIn,
78  TOut,
79  typename boost::enable_if<
80  typename boost::mpl::and_<
81  typename boost::mpl::equal_to<
82  boost::mpl::sizeof_<TIn>,
83  boost::mpl::sizeof_<TOut>
84  >::type,
85  typename boost::mpl::or_<
86  typename boost::mpl::and_<
87  typename boost::mpl::not_<typename boost::is_integral<TIn>::type>::type,
88  typename boost::is_integral<TOut>::type
89  >::type,
90  typename boost::mpl::and_<
91  typename boost::mpl::not_<typename boost::is_integral<TOut>::type>::type,
92  typename boost::is_integral<TIn>::type
93  >::type
94  >::type
95  >::type
96  >::type
97 >
98 {
99  static IPSDK_FORCEINLINE
100  void act(
103  {
105  }
106 };
107 
110 /*template <typename TOut>
111 struct MaskCastReg<
112  eInstructionSet::eIS_Sse2,
113  ipReal64,
114  TOut,
115  typename boost::enable_if<
116  typename boost::mpl::and_<
117  typename boost::mpl::equal_to<
118  boost::mpl::sizeof_<TOut>,
119  boost::mpl::int_<8>
120  >::type,
121  typename boost::is_integral<TOut>::type
122  >::type
123  >::type
124 >
125 {
126  static IPSDK_FORCEINLINE
127  void act(
128  const RegMaskType<eInstructionSet::eIS_Sse2, ipReal64>::Type& in,
129  typename RegMaskType<eInstructionSet::eIS_Sse2, TOut>::Type& out)
130  {
131  BitwiseCastReg<eInstructionSet::eIS_Sse2, ipReal64, TOut>::act(in, out);
132  }
133 };*/
134 
137 template <typename TIn, typename TOut>
138 struct MaskCastReg<
140  TIn,
141  TOut,
142  typename boost::enable_if<
143  typename boost::mpl::and_<
144  typename boost::mpl::equal_to<
145  boost::mpl::sizeof_<TIn>,
146  boost::mpl::int_<1>
147  >::type,
148  typename boost::mpl::equal_to<
149  boost::mpl::sizeof_<TOut>,
150  boost::mpl::int_<2>
151  >::type
152  >::type
153  >::type
154 >
155 {
156  static IPSDK_FORCEINLINE
157  void act(
161  {
167  }
168 };
169 
172 template <typename TIn, typename TOut>
173 struct MaskCastReg<
175  TIn,
176  TOut,
177  typename boost::enable_if<
178  typename boost::mpl::and_<
179  typename boost::mpl::equal_to<
180  boost::mpl::sizeof_<TIn>,
181  boost::mpl::int_<1>
182  >::type,
183  typename boost::mpl::equal_to<
184  boost::mpl::sizeof_<TOut>,
185  boost::mpl::int_<4>
186  >::type
187  >::type
188  >::type
189 >
190 {
191  static IPSDK_FORCEINLINE
192  void act(
198  {
199  typedef typename UpperType<TIn>::Type T16;
204  }
205 };
206 
209 template <typename TIn, typename TOut>
210 struct MaskCastReg<
212  TIn,
213  TOut,
214  typename boost::enable_if<
215  typename boost::mpl::and_<
216  typename boost::mpl::equal_to<
217  boost::mpl::sizeof_<TIn>,
218  boost::mpl::int_<1>
219  >::type,
220  typename boost::mpl::equal_to<
221  boost::mpl::sizeof_<TOut>,
222  boost::mpl::int_<8>
223  >::type
224  >::type
225  >::type
226 >
227 {
228  static IPSDK_FORCEINLINE
229  void act(
239  {
240  typedef typename UpperType<TIn>::Type T16;
243 
244  typedef typename UpperType<T16>::Type T32;
245  typename RegMaskType<eInstructionSet::eIS_Sse2, T32>::Type in32_0, in32_1, in32_2, in32_3;
248 
253  }
254 };
255 
258 template <typename TIn, typename TOut>
259 struct MaskCastReg<
261  TIn,
262  TOut,
263  typename boost::enable_if<
264  typename boost::mpl::and_<
265  typename boost::mpl::equal_to<
266  boost::mpl::sizeof_<TIn>,
267  boost::mpl::int_<2>
268  >::type,
269  typename boost::mpl::equal_to<
270  boost::mpl::sizeof_<TOut>,
271  boost::mpl::int_<4>
272  >::type
273  >::type
274  >::type
275 >
276 {
277  static IPSDK_FORCEINLINE
278  void act(
282  {
288  }
289 };
290 
293 template <typename TIn, typename TOut>
294 struct MaskCastReg<
296  TIn,
297  TOut,
298  typename boost::enable_if<
299  typename boost::mpl::and_<
300  typename boost::mpl::equal_to<
301  boost::mpl::sizeof_<TIn>,
302  boost::mpl::int_<2>
303  >::type,
304  typename boost::mpl::equal_to<
305  boost::mpl::sizeof_<TOut>,
306  boost::mpl::int_<8>
307  >::type
308  >::type
309  >::type
310 >
311 {
312  static IPSDK_FORCEINLINE
313  void act(
319  {
320  typedef typename UpperType<TIn>::Type T32;
325  }
326 };
327 
330 template <typename TIn, typename TOut>
331 struct MaskCastReg<
333  TIn,
334  TOut,
335  typename boost::enable_if<
336  typename boost::mpl::and_<
337  typename boost::mpl::and_<
338  typename boost::mpl::equal_to<
339  boost::mpl::sizeof_<TIn>,
340  boost::mpl::int_<4>
341  >::type,
342  typename boost::is_integral<TIn>::type
343  >::type,
344  typename boost::mpl::equal_to<
345  boost::mpl::sizeof_<TOut>,
346  boost::mpl::int_<8>
347  >::type
348  >::type
349  >::type
350 >
351 {
352  static IPSDK_FORCEINLINE
353  void act(
357  {
363  }
364 };
365 
368 template <typename TOut>
369 struct MaskCastReg<
371  ipReal32,
372  TOut,
373  typename boost::enable_if<
374  typename boost::mpl::equal_to<
375  boost::mpl::sizeof_<TOut>,
376  boost::mpl::int_<8>
377  >::type
378  >::type
379 >
380 {
381  static IPSDK_FORCEINLINE
382  void act(
386  {
390  }
391 };
392 
395 template <typename TIn, typename TOut>
396 struct MaskCastReg<
398  TIn,
399  TOut,
400  typename boost::enable_if<
401  typename boost::mpl::and_<
402  typename boost::mpl::equal_to<
403  boost::mpl::sizeof_<TIn>,
404  boost::mpl::int_<2>
405  >::type,
406  typename boost::mpl::equal_to<
407  boost::mpl::sizeof_<TOut>,
408  boost::mpl::int_<1>
409  >::type
410  >::type
411  >::type
412 >
413 {
414  static IPSDK_FORCEINLINE
415  void act(
419  {
424  }
425 };
426 
429 template <typename TIn, typename TOut>
430 struct MaskCastReg<
432  TIn,
433  TOut,
434  typename boost::enable_if<
435  typename boost::mpl::and_<
436  typename boost::mpl::and_<
437  typename boost::mpl::equal_to<
438  boost::mpl::sizeof_<TIn>,
439  boost::mpl::int_<4>
440  >::type,
441  typename boost::is_integral<TIn>::type
442  >::type,
443  typename boost::mpl::equal_to<
444  boost::mpl::sizeof_<TOut>,
445  boost::mpl::int_<2>
446  >::type
447  >::type
448  >::type
449 >
450 {
451  static IPSDK_FORCEINLINE
452  void act(
456  {
461  }
462 };
463 
466 template <typename TOut>
467 struct MaskCastReg<
469  ipReal32,
470  TOut,
471  typename boost::enable_if<
472  typename boost::mpl::equal_to<
473  boost::mpl::sizeof_<TOut>,
474  boost::mpl::int_<2>
475  >::type
476  >::type
477 >
478 {
479  static IPSDK_FORCEINLINE
480  void act(
484  {
489  }
490 };
491 
494 template <typename TIn, typename TOut>
495 struct MaskCastReg<
497  TIn,
498  TOut,
499  typename boost::enable_if<
500  typename boost::mpl::and_<
501  typename boost::mpl::and_<
502  typename boost::mpl::equal_to<
503  boost::mpl::sizeof_<TIn>,
504  boost::mpl::int_<4>
505  >::type,
506  typename boost::is_integral<TIn>::type
507  >::type,
508  typename boost::mpl::equal_to<
509  boost::mpl::sizeof_<TOut>,
510  boost::mpl::int_<1>
511  >::type
512  >::type
513  >::type
514 >
515 {
516  static IPSDK_FORCEINLINE
517  void act(
523  {
528  }
529 };
530 
533 template <typename TOut>
534 struct MaskCastReg<
536  ipReal32,
537  TOut,
538  typename boost::enable_if<
539  typename boost::mpl::equal_to<
540  boost::mpl::sizeof_<TOut>,
541  boost::mpl::int_<1>
542  >::type
543  >::type
544 >
545 {
546  static IPSDK_FORCEINLINE
547  void act(
553  {
559  MaskCastReg<eInstructionSet::eIS_Sse2, ipUInt32, TOut>::act(inUI0, inUI1, inUI2, inUI3, out);
560  }
561 };
562 
565 /*template <typename TIn, typename TOut>
566 struct MaskCastReg<
567  eInstructionSet::eIS_Sse2,
568  TIn,
569  TOut,
570  typename boost::enable_if<
571  typename boost::mpl::and_<
572  typename boost::mpl::and_<
573  typename boost::mpl::equal_to<
574  boost::mpl::sizeof_<TIn>,
575  boost::mpl::int_<8>
576  >::type,
577  typename boost::is_integral<TIn>::type
578  >::type,
579  typename boost::mpl::and_<
580  typename boost::mpl::equal_to<
581  boost::mpl::sizeof_<TOut>,
582  boost::mpl::int_<4>
583  >::type,
584  typename boost::is_integral<TOut>::type
585  >::type
586  >::type
587  >::type
588 >
589 {
590  static IPSDK_FORCEINLINE
591  void act(
592  const typename RegMaskType<eInstructionSet::eIS_Sse2, TIn>::Type& in0,
593  const typename RegMaskType<eInstructionSet::eIS_Sse2, TIn>::Type& in1,
594  typename RegMaskType<eInstructionSet::eIS_Sse2, TOut>::Type& out)
595  {
596  typename RegType<eInstructionSet::eIS_Sse2, TOut>::Type zero;
597  AssignReg<eInstructionSet::eIS_Sse2, TOut>::act(zero, 0);
598  CastReg<eInstructionSet::eIS_Sse2, ipInt64, ipInt32>::act(in0, in1, out);
599  IsNotEqualReg<eInstructionSet::eIS_Sse2, TOut>::act(out, zero, out);
600  }
601 };*/
602 
605 template <typename TOut>
606 struct MaskCastReg<
608  ipReal64,
609  TOut,
610  typename boost::enable_if<
611  typename boost::mpl::and_<
612  typename boost::mpl::equal_to<
613  boost::mpl::sizeof_<TOut>,
614  boost::mpl::int_<4>
615  >::type,
616  typename boost::is_integral<TOut>::type
617  >::type
618  >::type
619 >
620 {
621  static IPSDK_FORCEINLINE
622  void act(
626  {
630  }
631 };
632 
635 template <typename TIn>
636 struct MaskCastReg<
638  TIn,
639  ipReal32,
640  typename boost::enable_if<
641  typename boost::mpl::and_<
642  typename boost::mpl::equal_to<
643  boost::mpl::sizeof_<TIn>,
644  boost::mpl::int_<8>
645  >::type,
646  typename boost::is_integral<TIn>::type
647  >::type
648  >::type
649 >
650 {
651  static IPSDK_FORCEINLINE
652  void act(
656  {
660  }
661 };
662 
665 template <typename TIn, typename TOut>
666 struct MaskCastReg<
668  TIn,
669  TOut,
670  typename boost::enable_if<
671  typename boost::mpl::and_<
672  typename boost::mpl::and_<
673  typename boost::mpl::equal_to<
674  boost::mpl::sizeof_<TIn>,
675  boost::mpl::int_<8>
676  >::type,
677  typename boost::is_integral<TIn>::type
678  >::type,
679  typename boost::mpl::and_<
680  typename boost::mpl::equal_to<
681  boost::mpl::sizeof_<TOut>,
682  boost::mpl::int_<2>
683  >::type,
684  typename boost::is_integral<TOut>::type
685  >::type
686  >::type
687  >::type
688 >
689 {
690  static IPSDK_FORCEINLINE
691  void act(
697  {
702  }
703 };
704 
707 template <typename TOut>
708 struct MaskCastReg<
710  ipReal64,
711  TOut,
712  typename boost::enable_if<
713  typename boost::mpl::and_<
714  typename boost::mpl::equal_to<
715  boost::mpl::sizeof_<TOut>,
716  boost::mpl::int_<2>
717  >::type,
718  typename boost::is_integral<TOut>::type
719  >::type
720  >::type
721 >
722 {
723  static IPSDK_FORCEINLINE
724  void act(
730  {
731 
735 
737  in0F32, in1F32, out);
738  }
739 };
740 
743 template <typename TIn, typename TOut>
744 struct MaskCastReg<
746  TIn,
747  TOut,
748  typename boost::enable_if<
749  typename boost::mpl::and_<
750  typename boost::mpl::and_<
751  typename boost::mpl::equal_to<
752  boost::mpl::sizeof_<TIn>,
753  boost::mpl::int_<8>
754  >::type,
755  typename boost::is_integral<TIn>::type
756  >::type,
757  typename boost::mpl::and_<
758  typename boost::mpl::equal_to<
759  boost::mpl::sizeof_<TOut>,
760  boost::mpl::int_<1>
761  >::type,
762  typename boost::is_integral<TOut>::type
763  >::type
764  >::type
765  >::type
766 >
767 {
768  static IPSDK_FORCEINLINE
769  void act(
779  {
786  }
787 };
788 
791 template <typename TOut>
792 struct MaskCastReg<
794  ipReal64,
795  TOut,
796  typename boost::enable_if<
797  typename boost::mpl::and_<
798  typename boost::mpl::equal_to<
799  boost::mpl::sizeof_<TOut>,
800  boost::mpl::int_<1>
801  >::type,
802  typename boost::is_integral<TOut>::type
803  >::type
804  >::type
805 >
806 {
807  static IPSDK_FORCEINLINE
808  void act(
818  {
819 
820  RegMaskType<eInstructionSet::eIS_Sse2, ipInt64>::Type in0I, in1I, in2I, in3I, in4I, in5I, in6I, in7I;
829 
831  in0I, in1I, in2I, in3I, in4I, in5I, in6I, in7I, out);
832  }
833 };
836 
837 } // end of namespace detail
838 } // end of namespace simd
839 } // end of namespace ipsdk
840 
841 #endif // __IPSDKUTIL_INSTRUCTIONSET_DETAIL_SSE2_MASKCASTREG_H__
Definition: MaskCastReg.h:30
Defines the IPSDK_FORCEINLINE.
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
double ipReal64
Base types definition.
Definition: BaseTypes.h:57
Definition: CastReg.h:30
eInstructionSet
Enumerate for processor instruction set description.
Definition: InstructionSetTypes.h:31
template structure UpperType<typename T>; its typedef Type gives the type just upper to T...
Definition: UpperType.h:42
RegMaskType class.
Definition of import/export macro for library.
Definition: IsNotEqualRegDecl.h:30
Definition: RegMaskType.h:29
Definition: BitwiseCastReg.h:29
Streaming SIMD Extensions 2.
Definition: InstructionSetTypes.h:36
Definition: RegType.h:29
Definition: AssignRegDecl.h:31
float ipReal32
Base types definition.
Definition: BaseTypes.h:56