IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
AddReg.h
Go to the documentation of this file.
1 // AddReg.h:
3 // -------------------
4 //
14 
15 #ifndef __IPSDKUTIL_INSTRUCTIONSET_ARITHMETIC_DETAIL_AVX512_ADDREG_H__
16 #define __IPSDKUTIL_INSTRUCTIONSET_ARITHMETIC_DETAIL_AVX512_ADDREG_H__
17 
20 #include <IPSDKUtil/InstructionSet/Arithmetic/detail/AddReg.h>
22 
23 namespace ipsdk {
24 namespace simd {
25 namespace detail {
26 
29 
32 template <typename T>
34  typename boost::enable_if_c<boost::is_integral<T>::value
35  && sizeof(T)==1>::type>
36 {
37  static IPSDK_FORCEINLINE
38  typename Avx512Type<T>::Type
39  act(const typename Avx512Type<T>::Type& in1, const typename Avx512Type<T>::Type& in2)
40  {
41  return _mm512_add_epi8(in1, in2);
42  }
43 
44  static IPSDK_FORCEINLINE
45  void
46  act(const typename Avx512Type<T>::Type& in1,
47  const typename Avx512Type<T>::Type& in2,
48  typename Avx512Type<T>::Type& out)
49  {
50  out = _mm512_add_epi8(in1, in2);
51  }
52 };
53 
56 template <typename T>
58  typename boost::enable_if_c<boost::is_integral<T>::value
59  && sizeof(T)==2>::type>
60 {
61  static IPSDK_FORCEINLINE
62  typename AvxType<T>::Type
63  act(const typename Avx512Type<T>::Type& in1, const typename Avx512Type<T>::Type& in2)
64  {
65  return _mm512_add_epi16(in1, in2);
66  }
67 
68  static IPSDK_FORCEINLINE
69  void
70  act(const typename Avx512Type<T>::Type& in1,
71  const typename Avx512Type<T>::Type& in2,
72  typename Avx512Type<T>::Type& out)
73  {
74  out = _mm512_add_epi16(in1, in2);
75  }
76 };
77 
80 template <typename T>
82  typename boost::enable_if_c<boost::is_integral<T>::value
83  && sizeof(T)==4>::type>
84 {
85  static IPSDK_FORCEINLINE
86  typename Avx512Type<T>::Type
87  act(const typename Avx512Type<T>::Type& in1, const typename Avx512Type<T>::Type& in2)
88  {
89  return _mm512_add_epi32(in1, in2);
90  }
91 
92  static IPSDK_FORCEINLINE
93  void
94  act(const typename Avx512Type<T>::Type& in1,
95  const typename Avx512Type<T>::Type& in2,
96  typename Avx512Type<T>::Type& out)
97  {
98  out = _mm512_add_epi32(in1, in2);
99  }
100 };
101 
104 template <typename T>
106  typename boost::enable_if_c<boost::is_integral<T>::value
107  && sizeof(T)==8>::type>
108 {
109  static IPSDK_FORCEINLINE
110  typename Avx512Type<T>::Type
111  act(const typename Avx512Type<T>::Type& in1,
112  const typename Avx512Type<T>::Type& in2)
113  {
114  return _mm512_add_epi64(in1, in2);
115  }
116 
117  static IPSDK_FORCEINLINE
118  void
119  act(const typename Avx512Type<T>::Type& in1,
120  const typename Avx512Type<T>::Type& in2,
121  typename Avx512Type<T>::Type& out)
122  {
123  out = _mm512_add_epi64(in1, in2);
124  }
125 };
126 
127 
130 template <>
132 {
133  static IPSDK_FORCEINLINE
135  act(const Avx512Type<ipReal32>::Type& in1,
136  const Avx512Type<ipReal32>::Type& in2)
137  {
138  return _mm512_add_ps(in1, in2);
139  }
140 
141  static IPSDK_FORCEINLINE
142  void
143  act(const Avx512Type<ipReal32>::Type& in1,
144  const Avx512Type<ipReal32>::Type& in2,
146  {
147  out = _mm512_add_ps(in1, in2);
148  }
149 };
150 
153 template <>
155 {
156  static IPSDK_FORCEINLINE
158  act(const Avx512Type<ipReal64>::Type& in1, const Avx512Type<ipReal64>::Type& in2)
159  {
160  return _mm512_add_pd(in1, in2);
161  }
162 
163  static IPSDK_FORCEINLINE
164  void
165  act(const Avx512Type<ipReal64>::Type& in1,
166  const Avx512Type<ipReal64>::Type& in2,
168  {
169  out = _mm512_add_pd(in1, in2);
170  }
171 };
172 
175 
176 } // end of namespace detail
177 } // end of namespace simd
178 } // end of namespace ipsdk
179 
180 #endif // __IPSDKUTIL_INSTRUCTIONSET_ARITHMETIC_DETAIL_AVX512_ADDREG_H__
Defines the IPSDK_FORCEINLINE.
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
double ipReal64
Base types definition.
Definition: BaseTypes.h:57
(including fundation and byte and word instructions)
Definition: InstructionSetTypes.h:51
eInstructionSet
Enumerate for processor instruction set description.
Definition: InstructionSetTypes.h:31
Predefined types for Avx512 instruction set management.
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
structure used to retrieve AVX type associated to a base type
Definition: AvxTypes.h:33
float ipReal32
Base types definition.
Definition: BaseTypes.h:56
structure used to retrieve AVX512 type associated to a base type
Definition: Avx512Types.h:36