IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
IsLessEqualRegImpl.h
Go to the documentation of this file.
1 // IsLessEqualRegImpl.h:
3 // -------------------
4 //
14 
15 #ifndef __IPSDKUTIL_INSTRUCTIONSET_COMPARISON_DETAIL_SSE2_ISLESSEQUALREGIMPL_H__
16 #define __IPSDKUTIL_INSTRUCTIONSET_COMPARISON_DETAIL_SSE2_ISLESSEQUALREGIMPL_H__
17 
22 
23 #include <boost/type_traits/is_integral.hpp>
24 #include <boost/utility/enable_if.hpp>
25 
26 namespace ipsdk {
27 namespace simd {
28 namespace detail {
29 
32 
33 template <typename T>
34 IPSDK_FORCEINLINE
35 typename RegMaskType<eInstructionSet::eIS_Sse2, T>::Type
36 IsLessEqualReg<eInstructionSet::eIS_Sse2, T,
37  typename boost::enable_if_c<
38  boost::is_integral<T>::value
39  >::type
40 >::act(
41  const typename Sse2Type<T>::Type& in1,
42  const typename Sse2Type<T>::Type& in2)
43 {
44  return BitwiseNotReg<eInstructionSet::eIS_Sse2, T>::act(
45  IsGreaterReg<eInstructionSet::eIS_Sse2, T>::act(in1, in2));
46 }
47 
48 template <typename T>
49 IPSDK_FORCEINLINE
50 typename RegMaskType<eInstructionSet::eIS_Sse2, T>::Type
51 IsLessEqualReg<eInstructionSet::eIS_Sse2, T,
52  typename boost::enable_if_c<
53  boost::is_integral<T>::value
54  >::type
55 >::act(
56  const typename Sse2Type<T>::Type& in1,
57  const T& in2)
58 {
59  const typename Sse2Type<T>::Type regIn2 =
60  AssignReg<eInstructionSet::eIS_Sse2, T>::act(in2);
61  return BitwiseNotReg<eInstructionSet::eIS_Sse2, T>::act(
62  IsGreaterReg<eInstructionSet::eIS_Sse2, T>::act(in1, regIn2));
63 }
64 
65 
66 template <typename T>
67 IPSDK_FORCEINLINE
68 void
69 IsLessEqualReg<eInstructionSet::eIS_Sse2, T,
70  typename boost::enable_if_c<
71  boost::is_integral<T>::value
72  >::type
73 >::act(
74  const typename Sse2Type<T>::Type& in1,
75  const typename Sse2Type<T>::Type& in2,
76  typename RegMaskType<eInstructionSet::eIS_Sse2, T>::Type& out)
77 {
78  IsGreaterReg<eInstructionSet::eIS_Sse2, T>::act(in1, in2, out);
79  BitwiseNotReg<eInstructionSet::eIS_Sse2, T>::act(out, out);
80 }
81 
82 template <typename T>
83 IPSDK_FORCEINLINE
84 void
85 IsLessEqualReg<eInstructionSet::eIS_Sse2, T,
86  typename boost::enable_if_c<
87  boost::is_integral<T>::value
88  >::type
89 >::act(
90  const typename Sse2Type<T>::Type& in1,
91  const T& in2,
92  typename RegMaskType<eInstructionSet::eIS_Sse2, T>::Type& out)
93 {
94  const typename Sse2Type<T>::Type regIn2 =
95  AssignReg<eInstructionSet::eIS_Sse2, T>::act(in2);
96  IsGreaterReg<eInstructionSet::eIS_Sse2, T>::act(in1, regIn2, out);
97  BitwiseNotReg<eInstructionSet::eIS_Sse2, T>::act(out, out);
98 }
99 
100 IPSDK_FORCEINLINE
101 RegMaskType<eInstructionSet::eIS_Sse2, ipReal32>::Type
102 IsLessEqualReg<eInstructionSet::eIS_Sse2, ipReal32>::act(
103  const Sse2Type<ipReal32>::Type& in1,
104  const Sse2Type<ipReal32>::Type& in2)
105 {
106  return _mm_cmple_ps(in1, in2);
107 }
108 
109 IPSDK_FORCEINLINE
110 RegMaskType<eInstructionSet::eIS_Sse2, ipReal32>::Type
111 IsLessEqualReg<eInstructionSet::eIS_Sse2, ipReal32>::act(
112  const Sse2Type<ipReal32>::Type& in1,
113  const ipReal32& in2)
114 {
115  const Sse2Type<ipReal32>::Type regIn2 =
116  AssignReg<eInstructionSet::eIS_Sse2, ipReal32>::act(in2);
117  return _mm_cmple_ps(in1, regIn2);
118 }
119 
120 IPSDK_FORCEINLINE
121 void
122 IsLessEqualReg<eInstructionSet::eIS_Sse2, ipReal32>::act(
123  const Sse2Type<ipReal32>::Type& in1,
124  const Sse2Type<ipReal32>::Type& in2,
125  RegMaskType<eInstructionSet::eIS_Sse2, ipReal32>::Type& out)
126 {
127  out = _mm_cmple_ps(in1, in2);
128 }
129 
130 IPSDK_FORCEINLINE
131 void
132 IsLessEqualReg<eInstructionSet::eIS_Sse2, ipReal32>::act(
133  const Sse2Type<ipReal32>::Type& in1,
134  const ipReal32& in2,
135  RegMaskType<eInstructionSet::eIS_Sse2, ipReal32>::Type& out)
136 {
137  const Sse2Type<ipReal32>::Type regIn2 =
138  AssignReg<eInstructionSet::eIS_Sse2, ipReal32>::act(in2);
139  out = _mm_cmple_ps(in1, regIn2);
140 }
141 
142 IPSDK_FORCEINLINE
143 RegMaskType<eInstructionSet::eIS_Sse2, ipReal64>::Type
144 IsLessEqualReg<eInstructionSet::eIS_Sse2, ipReal64>::act(
145  const Sse2Type<ipReal64>::Type& in1,
146  const Sse2Type<ipReal64>::Type& in2)
147 {
148  return _mm_cmple_pd(in1, in2);
149 }
150 
151 IPSDK_FORCEINLINE
152 RegMaskType<eInstructionSet::eIS_Sse2, ipReal64>::Type
153 IsLessEqualReg<eInstructionSet::eIS_Sse2, ipReal64>::act(
154  const Sse2Type<ipReal64>::Type& in1,
155  const ipReal64& in2)
156 {
157  const Sse2Type<ipReal64>::Type regIn2 =
158  AssignReg<eInstructionSet::eIS_Sse2, ipReal64>::act(in2);
159  return _mm_cmple_pd(in1, regIn2);
160 }
161 
162 IPSDK_FORCEINLINE
163 void
164 IsLessEqualReg<eInstructionSet::eIS_Sse2, ipReal64>::act(
165  const Sse2Type<ipReal64>::Type& in1,
166  const Sse2Type<ipReal64>::Type& in2,
167  RegMaskType<eInstructionSet::eIS_Sse2, ipReal64>::Type& out)
168 {
169  out = _mm_cmple_pd(in1, in2);
170 }
171 
172 IPSDK_FORCEINLINE
173 void
174 IsLessEqualReg<eInstructionSet::eIS_Sse2, ipReal64>::act(
175  const Sse2Type<ipReal64>::Type& in1,
176  const ipReal64& in2,
177  RegMaskType<eInstructionSet::eIS_Sse2, ipReal64>::Type& out)
178 {
179  const Sse2Type<ipReal64>::Type regIn2 =
180  AssignReg<eInstructionSet::eIS_Sse2, ipReal64>::act(in2);
181  out = _mm_cmple_pd(in1, regIn2);
182 }
183 
186 
187 } // end of namespace detail
188 } // end of namespace simd
189 } // end of namespace ipsdk
190 
192 
193 #endif // __IPSDKUTIL_INSTRUCTIONSET_COMPARISON_DETAIL_SSE2_ISLESSEQUALREGIMPL_H__
declaration of specialized BitwiseAndReg structure for SSE2 instruction set
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
double ipReal64
Base types definition.
Definition: BaseTypes.h:57
Streaming SIMD Extensions 2.
Definition: InstructionSetTypes.h:36
float ipReal32
Base types definition.
Definition: BaseTypes.h:56