IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
SubReg.h
Go to the documentation of this file.
1 // SubReg.h:
3 // -------------------
4 //
14 
15 #ifndef __IPSDKUTIL_INSTRUCTIONSET_ARITHMETIC_DETAIL_AVX2_SUBREG_H__
16 #define __IPSDKUTIL_INSTRUCTIONSET_ARITHMETIC_DETAIL_AVX2_SUBREG_H__
17 
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,
40  const typename AvxType<T>::Type& in2)
41  {
42  return _mm256_sub_epi8(in1, in2);
43  }
44 
45  static IPSDK_FORCEINLINE
46  void
47  act(const typename AvxType<T>::Type& in1,
48  const typename AvxType<T>::Type& in2,
49  typename AvxType<T>::Type& out)
50  {
51  out = _mm256_sub_epi8(in1, in2);
52  }
53 };
54 
57 template <typename T>
59  typename boost::enable_if_c<boost::is_integral<T>::value
60  && sizeof(T)==2>::type>
61 {
62  static IPSDK_FORCEINLINE
63  typename AvxType<T>::Type
64  act(const typename AvxType<T>::Type& in1,
65  const typename AvxType<T>::Type& in2)
66  {
67  return _mm256_sub_epi16(in1, in2);
68  }
69 
70  static IPSDK_FORCEINLINE
71  void
72  act(const typename AvxType<T>::Type& in1,
73  const typename AvxType<T>::Type& in2,
74  typename AvxType<T>::Type& out)
75  {
76  out = _mm256_sub_epi16(in1, in2);
77  }
78 };
79 
82 template <typename T>
84  typename boost::enable_if_c<boost::is_integral<T>::value
85  && sizeof(T)==4>::type>
86 {
87  static IPSDK_FORCEINLINE
88  typename AvxType<T>::Type
89  act(const typename AvxType<T>::Type& in1,
90  const typename AvxType<T>::Type& in2)
91  {
92  return _mm256_sub_epi32(in1, in2);
93  }
94 
95  static IPSDK_FORCEINLINE
96  void
97  act(const typename AvxType<T>::Type& in1,
98  const typename AvxType<T>::Type& in2,
99  typename AvxType<T>::Type& out)
100  {
101  out = _mm256_sub_epi32(in1, in2);
102  }
103 };
104 
107 template <typename T>
109  typename boost::enable_if_c<boost::is_integral<T>::value
110  && sizeof(T)==8>::type>
111 {
112  static IPSDK_FORCEINLINE
113  typename AvxType<T>::Type
114  act(const typename AvxType<T>::Type& in1,
115  const typename AvxType<T>::Type& in2)
116  {
117  return _mm256_sub_epi64(in1, in2);
118  }
119 
120  static IPSDK_FORCEINLINE
121  void
122  act(const typename AvxType<T>::Type& in1,
123  const typename AvxType<T>::Type& in2,
124  typename AvxType<T>::Type& out)
125  {
126  out = _mm256_sub_epi64(in1, in2);
127  }
128 };
129 
132 template <>
134 {
135  static IPSDK_FORCEINLINE
137  act(const AvxType<ipReal32>::Type& in1,
138  const AvxType<ipReal32>::Type& in2)
139  {
141  }
142 
143  static IPSDK_FORCEINLINE
144  void
145  act(const AvxType<ipReal32>::Type& in1,
146  const AvxType<ipReal32>::Type& in2,
148  {
150  }
151 };
152 
155 template <>
157 {
158  static IPSDK_FORCEINLINE
160  act(const AvxType<ipReal64>::Type& in1,
161  const AvxType<ipReal64>::Type& in2)
162  {
164  }
165 
166  static IPSDK_FORCEINLINE
167  void
168  act(const AvxType<ipReal64>::Type& in1,
169  const AvxType<ipReal64>::Type& in2,
171  {
173  }
174 };
175 
178 
179 } // end of namespace detail
180 } // end of namespace simd
181 } // end of namespace ipsdk
182 
183 #endif // __IPSDKUTIL_INSTRUCTIONSET_ARITHMETIC_DETAIL_AVX2_SUBREG_H__
Defines the IPSDK_FORCEINLINE.
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
Definition: SubReg.h:39
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.
structure used to retrieve AVX type associated to a base type
Definition: AvxTypes.h:33
float ipReal32
Base types definition.
Definition: BaseTypes.h:56