IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
IsEqualRegImpl.h
Go to the documentation of this file.
1 // IsEqualRegImpl.h:
3 // -------------------
4 //
14 
15 #ifndef __IPSDKUTIL_INSTRUCTIONSET_COMPARISON_DETAIL_AVX2_ISEQUALREGIMPL_H__
16 #define __IPSDKUTIL_INSTRUCTIONSET_COMPARISON_DETAIL_AVX2_ISEQUALREGIMPL_H__
17 
20 
21 namespace ipsdk {
22 namespace simd {
23 namespace detail {
24 
27 
28 template <typename T>
29 IPSDK_FORCEINLINE
30 typename RegMaskType<eInstructionSet::eIS_Avx2, T>::Type
31 IsEqualReg<eInstructionSet::eIS_Avx2, T,
32  typename boost::enable_if<
33  typename boost::mpl::and_<
34  typename boost::is_integral<T>::type,
35  typename boost::mpl::equal_to<boost::mpl::int_<sizeof(T)>, boost::mpl::int_<1> >::type
36  >::type
37  >::type
38 >::act(
39  const typename AvxType<T>::Type& in1,
40  const typename AvxType<T>::Type& in2)
41 {
42  return _mm256_cmpeq_epi8(in1, in2);
43 }
44 
45 template <typename T>
46 IPSDK_FORCEINLINE
47 void
48 IsEqualReg<eInstructionSet::eIS_Avx2, T,
49  typename boost::enable_if<
50  typename boost::mpl::and_<
51  typename boost::is_integral<T>::type,
52  typename boost::mpl::equal_to<boost::mpl::int_<sizeof(T)>, boost::mpl::int_<1> >::type
53  >::type
54  >::type
55 >::act(
56  const typename AvxType<T>::Type& in1,
57  const typename AvxType<T>::Type& in2,
58  typename RegMaskType<eInstructionSet::eIS_Avx2, T>::Type& out)
59 {
60  out = _mm256_cmpeq_epi8(in1, in2);
61 }
62 
63 template <typename T>
64 IPSDK_FORCEINLINE
65 typename RegMaskType<eInstructionSet::eIS_Avx2, T>::Type
66 IsEqualReg<eInstructionSet::eIS_Avx2, T,
67  typename boost::enable_if<
68  typename boost::mpl::and_<
69  typename boost::is_integral<T>::type,
70  typename boost::mpl::equal_to<boost::mpl::int_<sizeof(T)>, boost::mpl::int_<2> >::type
71  >::type
72  >::type
73 >::act(
74  const typename AvxType<T>::Type& in1,
75  const typename AvxType<T>::Type& in2)
76 {
77  return _mm256_cmpeq_epi16(in1, in2);
78 }
79 
80 template <typename T>
81 IPSDK_FORCEINLINE
82 void
83 IsEqualReg<
85  T,
86  typename boost::enable_if<
87  typename boost::mpl::and_<
88  typename boost::is_integral<T>::type,
89  typename boost::mpl::equal_to<boost::mpl::int_<sizeof(T)>, boost::mpl::int_<2> >::type
90  >::type
91  >::type
92 >::act(
93  const typename AvxType<T>::Type& in1,
94  const typename AvxType<T>::Type& in2,
95  typename RegMaskType<eInstructionSet::eIS_Avx2, T>::Type& out)
96 {
97  out = _mm256_cmpeq_epi16(in1, in2);
98 }
99 
100 template <typename T>
101 IPSDK_FORCEINLINE
102 typename RegMaskType<eInstructionSet::eIS_Avx2, T>::Type
103 IsEqualReg<eInstructionSet::eIS_Avx2, T,
104  typename boost::enable_if<
105  typename boost::mpl::and_<
106  typename boost::is_integral<T>::type,
107  typename boost::mpl::equal_to<boost::mpl::int_<sizeof(T)>, boost::mpl::int_<4> >::type
108  >::type
109  >::type
110 >::act(
111  const typename AvxType<T>::Type& in1,
112  const typename AvxType<T>::Type& in2)
113 {
114  return _mm256_cmpeq_epi32(in1, in2);
115 }
116 
117 template <typename T>
118 IPSDK_FORCEINLINE
119 void
120 IsEqualReg<eInstructionSet::eIS_Avx2, T,
121  typename boost::enable_if<
122  typename boost::mpl::and_<
123  typename boost::is_integral<T>::type,
124  typename boost::mpl::equal_to<boost::mpl::int_<sizeof(T)>, boost::mpl::int_<4> >::type
125  >::type
126  >::type
127 >::act(
128  const typename AvxType<T>::Type& in1,
129  const typename AvxType<T>::Type& in2,
130  typename RegMaskType<eInstructionSet::eIS_Avx2, T>::Type& out)
131 {
132  out = _mm256_cmpeq_epi32(in1, in2);
133 }
134 
135 template <typename T>
136 IPSDK_FORCEINLINE
137 typename RegMaskType<eInstructionSet::eIS_Avx2, T>::Type
138 IsEqualReg<eInstructionSet::eIS_Avx2, T,
139  typename boost::enable_if<
140  typename boost::mpl::and_<
141  typename boost::is_integral<T>::type,
142  typename boost::mpl::equal_to<boost::mpl::int_<sizeof(T)>, boost::mpl::int_<8> >::type
143  >::type
144  >::type
145 >::act(
146  const typename AvxType<T>::Type& in1,
147  const typename AvxType<T>::Type& in2)
148 {
149  return _mm256_cmpeq_epi64(in1, in2);
150 }
151 
152 template <typename T>
153 IPSDK_FORCEINLINE
154 void
155 IsEqualReg<eInstructionSet::eIS_Avx2, T,
156  typename boost::enable_if<
157  typename boost::mpl::and_<
158  typename boost::is_integral<T>::type,
159  typename boost::mpl::equal_to<boost::mpl::int_<sizeof(T)>, boost::mpl::int_<8> >::type
160  >::type
161  >::type
162 >::act(const typename AvxType<T>::Type& in1,
163  const typename AvxType<T>::Type& in2,
164  typename RegMaskType<eInstructionSet::eIS_Avx2, T>::Type& out)
165 {
166  out = _mm256_cmpeq_epi64(in1, in2);
167 }
168 
169 IPSDK_FORCEINLINE
170 RegMaskType<eInstructionSet::eIS_Avx2, ipReal32>::Type
171 IsEqualReg<eInstructionSet::eIS_Avx2, ipReal32>::act(
172  const AvxType<ipReal32>::Type& in1,
173  const AvxType<ipReal32>::Type& in2)
174 {
175  return IsEqualReg<eInstructionSet::eIS_Avx, ipReal32>::act(in1, in2);
176 }
177 
178 IPSDK_FORCEINLINE
179 void
180 IsEqualReg<eInstructionSet::eIS_Avx2, ipReal32>::act(
181  const AvxType<ipReal32>::Type& in1,
182  const AvxType<ipReal32>::Type& in2,
183  RegMaskType<eInstructionSet::eIS_Avx2, ipReal32>::Type& out)
184 {
185  IsEqualReg<eInstructionSet::eIS_Avx, ipReal32>::act(in1, in2, out);
186 }
187 
188 IPSDK_FORCEINLINE
189 RegMaskType<eInstructionSet::eIS_Avx2, ipReal64>::Type
190 IsEqualReg<eInstructionSet::eIS_Avx2, ipReal64>::act(
191  const AvxType<ipReal64>::Type& in1,
192  const AvxType<ipReal64>::Type& in2)
193 {
194  return IsEqualReg<eInstructionSet::eIS_Avx, ipReal64>::act(in1, in2);
195 }
196 
197 IPSDK_FORCEINLINE
198 void
199 IsEqualReg<eInstructionSet::eIS_Avx2, ipReal64>::act(
200  const AvxType<ipReal64>::Type& in1,
201  const AvxType<ipReal64>::Type& in2,
202  RegMaskType<eInstructionSet::eIS_Avx2, ipReal64>::Type& out)
203 {
204  IsEqualReg<eInstructionSet::eIS_Avx, ipReal64>::act(in1, in2, out);
205 }
206 
209 
210 } // end of namespace detail
211 } // end of namespace simd
212 } // end of namespace ipsdk
213 
215 
216 #endif // __IPSDKUTIL_INSTRUCTIONSET_COMPARISON_DETAIL_AVX2_ISEQUALREGIMPL_H__
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
IsEqualReg<eInstructionSet::domain instructionSet, typename T, typename Enable=void> structure...
Advanced Vector Extensions 2.
Definition: InstructionSetTypes.h:48