IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
IsLessRegImpl.h
Go to the documentation of this file.
1 // IsLessRegImpl.h:
3 // -------------------
4 //
14 
15 #ifndef __IPSDKUTIL_INSTRUCTIONSET_COMPARISON_DETAIL_SSE2_ISLESSREGIMPL_H__
16 #define __IPSDKUTIL_INSTRUCTIONSET_COMPARISON_DETAIL_SSE2_ISLESSREGIMPL_H__
17 
21 
22 namespace ipsdk {
23 namespace simd {
24 namespace detail {
25 
28 
29 template <>
30 IPSDK_FORCEINLINE
31 RegMaskType<eInstructionSet::eIS_Sse2, ipInt8>::Type
32 IsLessReg<eInstructionSet::eIS_Sse2, ipInt8>::act(
33  const Sse2Type<ipInt8>::Type& in1,
34  const Sse2Type<ipInt8>::Type& in2)
35 {
36  return _mm_cmplt_epi8(in1, in2);
37 }
38 
39 template <>
40 IPSDK_FORCEINLINE
41 void
42 IsLessReg<eInstructionSet::eIS_Sse2, ipInt8>::act(
43  const Sse2Type<ipInt8>::Type& in1,
44  const Sse2Type<ipInt8>::Type& in2,
45  RegMaskType<eInstructionSet::eIS_Sse2, ipInt8>::Type& out)
46 {
47  out = _mm_cmplt_epi8(in1, in2);
48 }
49 
50 template <>
51 IPSDK_FORCEINLINE
52 RegMaskType<eInstructionSet::eIS_Sse2, ipUInt8>::Type
53 IsLessReg<eInstructionSet::eIS_Sse2, ipUInt8>::act(
54  const Sse2Type<ipUInt8>::Type& in1,
55  const Sse2Type<ipUInt8>::Type& in2)
56 {
57  const Sse2Type<ipUInt8>::Type& c =
58  AssignReg<eInstructionSet::eIS_Sse2, ipUInt8>::act(0x80);
59  const Sse2Type<ipUInt8>::Type& in1Cvt =
60  BitwiseXOrReg<eInstructionSet::eIS_Sse2, ipUInt8>::act(in1, c);
61  const Sse2Type<ipUInt8>::Type& in2Cvt =
62  BitwiseXOrReg<eInstructionSet::eIS_Sse2, ipUInt8>::act(in2, c);
63 
64  return _mm_cmplt_epi8(in1Cvt, in2Cvt);
65 }
66 
67 template <>
68 IPSDK_FORCEINLINE
69 void
70 IsLessReg<eInstructionSet::eIS_Sse2, ipUInt8>::act(
71  const Sse2Type<ipUInt8>::Type& in1,
72  const Sse2Type<ipUInt8>::Type& in2,
73  RegMaskType<eInstructionSet::eIS_Sse2, ipUInt8>::Type& out)
74 {
75  Sse2Type<ipUInt8>::Type c;
76  AssignReg<eInstructionSet::eIS_Sse2, ipUInt8>::act(c, 0x80);
77  Sse2Type<ipUInt8>::Type in1Cvt;
78  BitwiseXOrReg<eInstructionSet::eIS_Sse2, ipUInt8>::act(in1, c, in1Cvt);
79  Sse2Type<ipUInt8>::Type in2Cvt;
80  BitwiseXOrReg<eInstructionSet::eIS_Sse2, ipUInt8>::act(in2, c, in2Cvt);
81 
82  out = _mm_cmplt_epi8(in1Cvt, in2Cvt);
83 }
84 
85 template <>
86 IPSDK_FORCEINLINE
87 RegMaskType<eInstructionSet::eIS_Sse2, ipInt16>::Type
88 IsLessReg<eInstructionSet::eIS_Sse2, ipInt16>::act(
89  const Sse2Type<ipInt16>::Type& in1,
90  const Sse2Type<ipInt16>::Type& in2)
91 {
92  return _mm_cmplt_epi16(in1, in2);
93 }
94 
95 template <>
96 IPSDK_FORCEINLINE
97 void
98 IsLessReg<eInstructionSet::eIS_Sse2, ipInt16>::act(
99  const Sse2Type<ipInt16>::Type& in1,
100  const Sse2Type<ipInt16>::Type& in2,
101  RegMaskType<eInstructionSet::eIS_Sse2, ipInt16>::Type& out)
102 {
103  out = _mm_cmplt_epi16(in1, in2);
104 }
105 
106 template <>
107 IPSDK_FORCEINLINE
108 RegMaskType<eInstructionSet::eIS_Sse2, ipUInt16>::Type
109 IsLessReg<eInstructionSet::eIS_Sse2, ipUInt16>::act(
110  const Sse2Type<ipUInt16>::Type& in1,
111  const Sse2Type<ipUInt16>::Type& in2)
112 {
113  const Sse2Type<ipUInt16>::Type& c =
114  AssignReg<eInstructionSet::eIS_Sse2, ipUInt16>::act(0x8000);
115  const Sse2Type<ipUInt16>::Type& in1Cvt =
116  BitwiseXOrReg<eInstructionSet::eIS_Sse2, ipUInt16>::act(in1, c);
117  const Sse2Type<ipUInt16>::Type& in2Cvt =
118  BitwiseXOrReg<eInstructionSet::eIS_Sse2, ipUInt16>::act(in2, c);
119 
120  return _mm_cmplt_epi16(in1Cvt, in2Cvt);
121 }
122 
123 template <>
124 IPSDK_FORCEINLINE
125 void
126 IsLessReg<eInstructionSet::eIS_Sse2, ipUInt16>::act(
127  const Sse2Type<ipUInt16>::Type& in1,
128  const Sse2Type<ipUInt16>::Type& in2,
129  RegMaskType<eInstructionSet::eIS_Sse2, ipUInt16>::Type& out)
130 {
131  Sse2Type<ipUInt16>::Type c;
132  AssignReg<eInstructionSet::eIS_Sse2, ipUInt16>::act(c, 0x8000);
133  Sse2Type<ipUInt16>::Type in1Cvt;
134  BitwiseXOrReg<eInstructionSet::eIS_Sse2, ipUInt16>::act(in1, c, in1Cvt);
135  Sse2Type<ipUInt16>::Type in2Cvt;
136  BitwiseXOrReg<eInstructionSet::eIS_Sse2, ipUInt16>::act(in2, c, in2Cvt);
137  out = _mm_cmplt_epi16(in1Cvt, in2Cvt);
138 }
139 
140 template <>
141 IPSDK_FORCEINLINE
142 RegMaskType<eInstructionSet::eIS_Sse2, ipInt32>::Type
143 IsLessReg<eInstructionSet::eIS_Sse2, ipInt32>::act(
144  const Sse2Type<ipInt32>::Type& in1,
145  const Sse2Type<ipInt32>::Type& in2)
146 {
147  return _mm_cmplt_epi32(in1, in2);
148 }
149 
150 template <>
151 IPSDK_FORCEINLINE
152 void
153 IsLessReg<eInstructionSet::eIS_Sse2, ipInt32>::act(
154  const Sse2Type<ipInt32>::Type& in1,
155  const Sse2Type<ipInt32>::Type& in2,
156  Sse2Type<ipInt32>::Type& out)
157 {
158  out = _mm_cmplt_epi32(in1, in2);
159 }
160 
161 template <>
162 IPSDK_FORCEINLINE
163 RegMaskType<eInstructionSet::eIS_Sse2, ipUInt32>::Type
164 IsLessReg<eInstructionSet::eIS_Sse2, ipUInt32>::act(
165  const Sse2Type<ipUInt32>::Type& in1,
166  const Sse2Type<ipUInt32>::Type& in2)
167 {
168  const Sse2Type<ipUInt32>::Type& c =
169  AssignReg<eInstructionSet::eIS_Sse2, ipUInt32>::act(0x80000000);
170  const Sse2Type<ipUInt32>::Type& in1Cvt =
171  BitwiseXOrReg<eInstructionSet::eIS_Sse2, ipUInt32>::act(in1, c);
172  const Sse2Type<ipUInt32>::Type& in2Cvt =
173  BitwiseXOrReg<eInstructionSet::eIS_Sse2, ipUInt32>::act(in2, c);
174 
175  return _mm_cmplt_epi32(in1Cvt, in2Cvt);
176 }
177 
178 template <>
179 IPSDK_FORCEINLINE
180 void
181 IsLessReg<eInstructionSet::eIS_Sse2, ipUInt32>::act(
182  const Sse2Type<ipUInt32>::Type& in1,
183  const Sse2Type<ipUInt32>::Type& in2,
184  RegMaskType<eInstructionSet::eIS_Sse2, ipUInt32>::Type& out)
185 {
186  Sse2Type<ipUInt32>::Type c;
187  AssignReg<eInstructionSet::eIS_Sse2, ipUInt32>::act(c, 0x80000000);
188  Sse2Type<ipUInt32>::Type in1Cvt;
189  BitwiseXOrReg<eInstructionSet::eIS_Sse2, ipUInt32>::act(in1, c, in1Cvt);
190  Sse2Type<ipUInt32>::Type in2Cvt;
191  BitwiseXOrReg<eInstructionSet::eIS_Sse2, ipUInt32>::act(in2, c, in2Cvt);
192 
193  out = _mm_cmplt_epi32(in1Cvt, in2Cvt);
194 }
195 
196 IPSDK_FORCEINLINE
197 RegMaskType<eInstructionSet::eIS_Sse2, ipReal32>::Type
198 IsLessReg<eInstructionSet::eIS_Sse2, ipReal32>::act(
199  const Sse2Type<ipReal32>::Type& in1,
200  const Sse2Type<ipReal32>::Type& in2)
201 {
202  return _mm_cmplt_ps(in1, in2);
203 }
204 
205 IPSDK_FORCEINLINE
206 void
207 IsLessReg<eInstructionSet::eIS_Sse2, ipReal32>::act(
208  const Sse2Type<ipReal32>::Type& in1,
209  const Sse2Type<ipReal32>::Type& in2,
210  RegMaskType<eInstructionSet::eIS_Sse2, ipReal32>::Type& out)
211 {
212  out = _mm_cmplt_ps(in1, in2);
213 }
214 
215 IPSDK_FORCEINLINE
216 RegMaskType<eInstructionSet::eIS_Sse2, ipReal64>::Type
217 IsLessReg<eInstructionSet::eIS_Sse2, ipReal64>::act(
218  const Sse2Type<ipReal64>::Type& in1,
219  const Sse2Type<ipReal64>::Type& in2)
220 {
221  return _mm_cmplt_pd(in1, in2);
222 }
223 
224 IPSDK_FORCEINLINE
225 void
226 IsLessReg<eInstructionSet::eIS_Sse2, ipReal64>::act(
227  const Sse2Type<ipReal64>::Type& in1,
228  const Sse2Type<ipReal64>::Type& in2,
229  RegMaskType<eInstructionSet::eIS_Sse2, ipReal64>::Type& out)
230 {
231  out = _mm_cmplt_pd(in1, in2);
232 }
233 
236 
237 } // end of namespace detail
238 } // end of namespace simd
239 } // end of namespace ipsdk
240 
242 
243 #endif // __IPSDKUTIL_INSTRUCTIONSET_COMPARISON_DETAIL_SSE2_ISLESSREGIMPL_H__
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22