IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
DivPack.h
Go to the documentation of this file.
1 // DivPack.h:
3 // -----------------
4 //
14 
15 #ifndef __IPSDKUTIL_INSTRUCTIONSET_ARITHMETIC_DETAIL_SSE2_DIVPACK_H__
16 #define __IPSDKUTIL_INSTRUCTIONSET_ARITHMETIC_DETAIL_SSE2_DIVPACK_H__
17 
26 
27 #include <boost/type_traits/is_same.hpp>
28 #include <boost/utility/enable_if.hpp>
29 
30 namespace ipsdk {
31 namespace simd {
32 namespace detail {
33 
36 
39 template <>
41 {
42  static
43  IPSDK_FORCEINLINE
47  {
50  }
51 
52  static
53  IPSDK_FORCEINLINE
54  void
58  {
60  DivReg<eInstructionSet::eIS_Sse2, ipReal32> >::act(in1, in2, out);
61  }
62 };
63 
66 template <>
68 {
69  static
70  IPSDK_FORCEINLINE
74  {
77  }
78 
79  static
80  IPSDK_FORCEINLINE
81  void
85  {
87  DivReg<eInstructionSet::eIS_Sse2, ipReal64> >::act(in1, in2, out);
88  }
89 };
90 
93 template <typename TIn1, typename TIn2>
94 struct DivPack<eInstructionSet::eIS_Sse2, TIn1, TIn2,
95  typename boost::enable_if_c<!boost::is_same<TIn1, TIn2>::value
96  && boost::is_same<TIn1, typename PromotedType<TIn1, TIn2>::Type>::value
97  >::type>
98 {
99  static
100  IPSDK_FORCEINLINE
102  act(const BasePack<ePackType::ePT_Sse, TIn1>& in1,
104  {
106  cast<eInstructionSet::eIS_Sse2, TIn2, TIn1>(in2);
108  }
109 
110  static
111  IPSDK_FORCEINLINE
112  void
113  act(const BasePack<ePackType::ePT_Sse, TIn1>& in1,
116  {
118  cast<eInstructionSet::eIS_Sse2, TIn2, TIn1>(in2, in2Promoted);
120  }
121 };
122 
125 template <typename TIn1, typename TIn2>
126 struct DivPack<eInstructionSet::eIS_Sse2, TIn1, TIn2,
127  typename boost::enable_if_c<!boost::is_same<TIn1, TIn2>::value
128  && !boost::is_same<TIn1, typename PromotedType<TIn1, TIn2>::Type>::value
129  >::type>
130 {
131  static
132  IPSDK_FORCEINLINE
134  act(const BasePack<ePackType::ePT_Sse, TIn1>& in1,
136  {
138  cast<eInstructionSet::eIS_Sse2, TIn1, TIn2>(in1);
140  in1Promoted, in2);
141  }
142 
143  static
144  IPSDK_FORCEINLINE
145  void
146  act(const BasePack<ePackType::ePT_Sse, TIn1>& in1,
149  {
151  cast<eInstructionSet::eIS_Sse2, TIn1, TIn2>(in1, in1Promoted);
153  in1Promoted, in2, out);
154  }
155 };
156 
159 template <typename TIn>
160 struct DivPack<eInstructionSet::eIS_Sse2, TIn, TIn,
161  typename boost::enable_if_c<boost::is_integral<TIn>::value>::type>
162 {
163  static
164  IPSDK_FORCEINLINE
166  act(const BasePack<ePackType::ePT_Sse, TIn>& in1,
168  {
170  cast<eInstructionSet::eIS_Sse2, TIn, ipReal32>(in1);
172  cast<eInstructionSet::eIS_Sse2, TIn, ipReal32>(in2);
175 
176  return cast<eInstructionSet::eIS_Sse2, ipReal32, TIn>(outCast);
177  }
178 
179  static
180  IPSDK_FORCEINLINE
181  void
182  act(const BasePack<ePackType::ePT_Sse, TIn>& in1,
185  {
187  cast<eInstructionSet::eIS_Sse2>(in1, in1Cast);
189  cast<eInstructionSet::eIS_Sse2>(in2, in2Cast);
192 
193  cast<eInstructionSet::eIS_Sse2>(outCast, out);
194  }
195 };
196 
200 
201 } // end of namespace detail
202 } // end of namespace simd
203 } // end of namespace ipsdk
204 
205 #endif // __IPSDKUTIL_INSTRUCTIONSET_ARITHMETIC_DETAIL_SSE2_DIVPACK_H__
Defines the IPSDK_FORCEINLINE.
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
cast function; casts a Pack<instructionSet, TIn> to a Pack<instructionSet, TOut>
Definition: DivPack.h:40
double ipReal64
Base types definition.
Definition: BaseTypes.h:57
BasePack class; defines a set of scalars (for instruction set "standard") or registers (for all other...
eInstructionSet
Enumerate for processor instruction set description.
Definition: InstructionSetTypes.h:31
defines template structures PromotedType<T1, T2> and PromotedType3<T1, T2, T3>; their attribute Type ...
Predefined types associated to instruction set management.
Definition of import/export macro for library.
DivReg template specialization for instruction set SSE2 and for ipReal64.
Definition: DivReg.h:56
Streaming SIMD Extensions 2.
Definition: InstructionSetTypes.h:36
float ipReal32
Base types definition.
Definition: BaseTypes.h:56
Definition: BinaryPackOp.h:31
DivReg template specialization for instruction set SSE2 and for ipReal32.
Definition: DivReg.h:33
structure containing intrinsic registers used to store vectorized data
Definition: BasePackDecl.h:29