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_AVX2_ADDREG_H__
16 #define __IPSDKUTIL_INSTRUCTIONSET_ARITHMETIC_DETAIL_AVX2_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 AvxType<T>::Type
39  act(const typename AvxType<T>::Type& in1, const typename AvxType<T>::Type& in2)
40  {
41  return _mm256_add_epi8(in1, in2);
42  }
43 
44  static IPSDK_FORCEINLINE
45  void
46  act(const typename AvxType<T>::Type& in1,
47  const typename AvxType<T>::Type& in2,
48  typename AvxType<T>::Type& out)
49  {
50  out = _mm256_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 AvxType<T>::Type& in1, const typename AvxType<T>::Type& in2)
64  {
65  return _mm256_add_epi16(in1, in2);
66  }
67 
68  static IPSDK_FORCEINLINE
69  void
70  act(const typename AvxType<T>::Type& in1,
71  const typename AvxType<T>::Type& in2,
72  typename AvxType<T>::Type& out)
73  {
74  out = _mm256_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 AvxType<T>::Type
87  act(const typename AvxType<T>::Type& in1, const typename AvxType<T>::Type& in2)
88  {
89  return _mm256_add_epi32(in1, in2);
90  }
91 
92  static IPSDK_FORCEINLINE
93  void
94  act(const typename AvxType<T>::Type& in1,
95  const typename AvxType<T>::Type& in2,
96  typename AvxType<T>::Type& out)
97  {
98  out = _mm256_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 AvxType<T>::Type
111  act(const typename AvxType<T>::Type& in1, const typename AvxType<T>::Type& in2)
112  {
113  return _mm256_add_epi64(in1, in2);
114  }
115 
116  static IPSDK_FORCEINLINE
117  void
118  act(const typename AvxType<T>::Type& in1,
119  const typename AvxType<T>::Type& in2,
120  typename AvxType<T>::Type& out)
121  {
122  out = _mm256_add_epi64(in1, in2);
123  }
124 };
125 
126 
129 template <>
131 {
132  static IPSDK_FORCEINLINE
134  act(const AvxType<ipReal32>::Type& in1, const AvxType<ipReal32>::Type& in2)
135  {
137  }
138 
139  static IPSDK_FORCEINLINE
140  void
141  act(const AvxType<ipReal32>::Type& in1,
142  const AvxType<ipReal32>::Type& in2,
144  {
146  }
147 };
148 
151 template <>
153 {
154  static IPSDK_FORCEINLINE
156  act(const AvxType<ipReal64>::Type& in1, const AvxType<ipReal64>::Type& in2)
157  {
159  }
160 
161  static IPSDK_FORCEINLINE
162  void
163  act(const AvxType<ipReal64>::Type& in1,
164  const AvxType<ipReal64>::Type& in2,
166  {
168  }
169 };
170 
173 
174 } // end of namespace detail
175 } // end of namespace simd
176 } // end of namespace ipsdk
177 
178 #endif // __IPSDKUTIL_INSTRUCTIONSET_ARITHMETIC_DETAIL_AVX2_ADDREG_H__
Defines the IPSDK_FORCEINLINE.
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
double ipReal64
Base types definition.
Definition: BaseTypes.h:57
Predefined types for Avx instruction set management.
eInstructionSet
Enumerate for processor instruction set description.
Definition: InstructionSetTypes.h:31
Advanced Vector Extensions 2.
Definition: InstructionSetTypes.h:48
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