IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
SumPack.h
Go to the documentation of this file.
1 // SumPack.h:
3 // -------------------
4 //
14 
15 #ifndef __IPSDKUTIL_INSTRUCTIONSET_REDUCTION_DETAIL_AVX512_SUMPACK_H__
16 #define __IPSDKUTIL_INSTRUCTIONSET_REDUCTION_DETAIL_AVX512_SUMPACK_H__
17 
23 
24 namespace ipsdk {
25 namespace simd {
26 namespace detail {
27 namespace reduction {
28 
31 
34 template <typename T>
36  typename boost::enable_if_c<boost::is_integral<T>::value
37  && sizeof(T) == 1>::type>
38 {
39  static IPSDK_FORCEINLINE
40  typename UpperType<T>::Type
42  {
43  typedef typename UpperType<T>::Type T16;
44  typedef typename UpperType<T16>::Type T32;
46 
47  const Pack32 in32 =
48  cast<eInstructionSet::eIS_Avx512, T32>(in);
49 
50  typename Avx512Type<T32>::Type resReg = AddReg<eInstructionSet::eIS_Avx512, T32>::act(in32._val[0], in32._val[1]);
51  resReg = AddReg<eInstructionSet::eIS_Avx512, T32>::act(resReg, in32._val[2]);
52  resReg = AddReg<eInstructionSet::eIS_Avx512, T32>::act(resReg, in32._val[3]);
53 
55  }
56 };
57 
60 template <typename T>
62  typename boost::enable_if_c<boost::is_integral<T>::value
63  && sizeof(T) == 2>::type>
64 {
65  static IPSDK_FORCEINLINE
66  typename UpperType<T>::Type
68  {
69  typedef typename UpperType<T>::Type T32;
71 
72  const Pack32 in32 =
73  cast<eInstructionSet::eIS_Avx512, T32>(in);
74 
75  typename Avx512Type<T32>::Type resReg = AddReg<eInstructionSet::eIS_Avx512, T32>::act(in32._val[0], in32._val[1]);
76  resReg = AddReg<eInstructionSet::eIS_Avx512, T32>::act(resReg, in32._val[2]);
77  resReg = AddReg<eInstructionSet::eIS_Avx512, T32>::act(resReg, in32._val[3]);
78 
80  }
81 };
82 
85 template <typename T>
87  typename boost::enable_if_c<sizeof(T) == 4>::type>
88 {
89  static IPSDK_FORCEINLINE
90  typename UpperType<T>::Type
92  {
93  typedef typename UpperType<T>::Type T64;
95 
96  const Pack64 in64 =
97  cast<eInstructionSet::eIS_Avx512, T64>(in);
98 
99  return static_cast<T64>(SumPack<eInstructionSet::eIS_Avx512, T64>::act(in64));
100 
101  }
102 };
103 
106 template <typename T>
108  typename boost::enable_if_c<sizeof(T) == 8>::type>
109 {
110  static IPSDK_FORCEINLINE
111  typename UpperType<T>::Type
113  {
114  typename Avx512Type<T>::Type resReg = AddReg<eInstructionSet::eIS_Avx512, T>::act(in._val[0], in._val[1]);
115  resReg = AddReg<eInstructionSet::eIS_Avx512, T>::act(resReg, in._val[2]);
116  resReg = AddReg<eInstructionSet::eIS_Avx512, T>::act(resReg, in._val[3]);
117  resReg = AddReg<eInstructionSet::eIS_Avx512, T>::act(resReg, in._val[4]);
118  resReg = AddReg<eInstructionSet::eIS_Avx512, T>::act(resReg, in._val[5]);
119  resReg = AddReg<eInstructionSet::eIS_Avx512, T>::act(resReg, in._val[6]);
120  resReg = AddReg<eInstructionSet::eIS_Avx512, T>::act(resReg, in._val[7]);
121 
123 
124  }
125 };
126 
129 
130 } // end of namespace reduction
131 } // end of namespace detail
132 } // end of namespace simd
133 } // end of namespace ipsdk
134 
135 #endif // __IPSDKUTIL_INSTRUCTIONSET_REDUCTION_DETAIL_AVX512_SUMPACK_H__
Defines the IPSDK_FORCEINLINE.
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
cast function; casts a Pack<instructionSet, TIn> to a Pack<instructionSet, TOut>
specialization of ipsdk::simd::detail::reduction::SumReg structure for AVX512 instruction set ...
(including fundation and byte and word instructions)
Definition: InstructionSetTypes.h:51
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
structure SumPack<eInstructionSet::domain instructionSet, typename T, typename Enable=void> ...
Definition: SumPack.h:40
Definition of import/export macro for library.
template structure which is specialized to implement the arithmetic addition on 2 scalars or 2 regist...
Definition: AddReg.h:37
specialization of ipsdk::simd::detail::AddReg structure for AVX512 instruction set ...
structure used to retrieve AVX512 type associated to a base type
Definition: Avx512Types.h:36
structure containing intrinsic registers used to store vectorized data
Definition: BasePackDecl.h:29