IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
PolynomPack.h
Go to the documentation of this file.
1 // PolynomPack.h:
3 // -------------------
4 //
14 
15 #ifndef __IPSDKUTIL_INSTRUCTIONSET_ARITHMETIC_DETAIL_AVX_POLYNOMPACK_H__
16 #define __IPSDKUTIL_INSTRUCTIONSET_ARITHMETIC_DETAIL_AVX_POLYNOMPACK_H__
17 
20 #include <IPSDKUtil/InstructionSet/Arithmetic/detail/PolynomReg.h>
22 
23 #include <boost/mpl/not_equal_to.hpp>
24 
25 namespace ipsdk {
26 namespace simd {
27 namespace detail {
28 
31 
32 #define DEFINE_POLYNOMPACK_AVX(N) \
33 template <typename T> \
34 struct PolynomPack<eInstructionSet::eIS_Avx, eInstructionSet::eIS_Avx, N, T, typename boost::enable_if_c<boost::mpl::equal_to<boost::mpl::int_<sizeof(T)>, boost::mpl::int_<4> >::value>::type> \
35 { \
36  static IPSDK_FORCEINLINE \
37  BasePack<ePackType::ePT_Avx, T> \
38  act(const BasePack<ePackType::ePT_Avx, T>& in, \
39  BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(N), const T& c)) \
40  { \
41  BasePack<ePackType::ePT_Scalar, T> out; \
42  act(in, BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(N), c), out); \
43  return out; \
44  } \
45  \
46  static IPSDK_FORCEINLINE \
47  void \
48  act(const BasePack<ePackType::ePT_Avx, T>& in, \
49  BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(N), const T& c), \
50  BasePack<ePackType::ePT_Avx, T>& out) \
51  { \
52  PolynomReg<eInstructionSet::eIS_Avx, eInstructionSet::eIS_Avx, N, T>::act(in._val[0], BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(N), c), out._val[0]); \
53  PolynomReg<eInstructionSet::eIS_Avx, eInstructionSet::eIS_Avx, N, T>::act(in._val[1], BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(N), c), out._val[1]); \
54  PolynomReg<eInstructionSet::eIS_Avx, eInstructionSet::eIS_Avx, N, T>::act(in._val[2], BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(N), c), out._val[2]); \
55  PolynomReg<eInstructionSet::eIS_Avx, eInstructionSet::eIS_Avx, N, T>::act(in._val[3], BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(N), c), out._val[3]); \
56  } \
57 }; \
58  \
59 template <typename T> \
60 struct PolynomPack<eInstructionSet::eIS_Avx, eInstructionSet::eIS_Fma3, N, T, typename boost::enable_if_c<boost::mpl::equal_to<boost::mpl::int_<sizeof(T)>, boost::mpl::int_<4> >::value>::type> \
61 { \
62  static IPSDK_FORCEINLINE \
63  BasePack<ePackType::ePT_Avx, T> \
64  act(const BasePack<ePackType::ePT_Avx, T>& in, \
65  BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(N), const T& c)) \
66  { \
67  BasePack<ePackType::ePT_Scalar, T> out; \
68  act(in, BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(N), c), out); \
69  return out; \
70  } \
71  \
72  static IPSDK_FORCEINLINE \
73  void \
74  act(const BasePack<ePackType::ePT_Avx, T>& in, \
75  BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(N), const T& c), \
76  BasePack<ePackType::ePT_Avx, T>& out) \
77  { \
78  PolynomReg<eInstructionSet::eIS_Avx, eInstructionSet::eIS_Fma3, N, T>::act(in._val[0], BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(N), c), out._val[0]); \
79  PolynomReg<eInstructionSet::eIS_Avx, eInstructionSet::eIS_Fma3, N, T>::act(in._val[1], BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(N), c), out._val[1]); \
80  PolynomReg<eInstructionSet::eIS_Avx, eInstructionSet::eIS_Fma3, N, T>::act(in._val[2], BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(N), c), out._val[2]); \
81  PolynomReg<eInstructionSet::eIS_Avx, eInstructionSet::eIS_Fma3, N, T>::act(in._val[3], BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(N), c), out._val[3]); \
82  } \
83 };
84 
85 DEFINE_POLYNOMPACK_AVX(20)
86 DEFINE_POLYNOMPACK_AVX(19)
87 DEFINE_POLYNOMPACK_AVX(18)
88 DEFINE_POLYNOMPACK_AVX(17)
89 DEFINE_POLYNOMPACK_AVX(16)
90 DEFINE_POLYNOMPACK_AVX(15)
91 DEFINE_POLYNOMPACK_AVX(14)
92 DEFINE_POLYNOMPACK_AVX(13)
93 DEFINE_POLYNOMPACK_AVX(12)
94 DEFINE_POLYNOMPACK_AVX(11)
95 DEFINE_POLYNOMPACK_AVX(10)
96 DEFINE_POLYNOMPACK_AVX(9)
97 DEFINE_POLYNOMPACK_AVX(8)
98 DEFINE_POLYNOMPACK_AVX(7)
99 DEFINE_POLYNOMPACK_AVX(6)
100 DEFINE_POLYNOMPACK_AVX(5)
101 DEFINE_POLYNOMPACK_AVX(4)
102 DEFINE_POLYNOMPACK_AVX(3)
103 DEFINE_POLYNOMPACK_AVX(2)
104 DEFINE_POLYNOMPACK_AVX(1)
105 
108 
109 } // end of namespace detail
110 } // end of namespace simd
111 } // end of namespace ipsdk
112 
113 #endif // __IPSDKUTIL_INSTRUCTIONSET_ARITHMETIC_DETAIL_AVX_POLYNOMPACK_H__
Defines the IPSDK_FORCEINLINE.
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
BasePack class; defines a set of scalars (for instruction set "standard") or registers (for all other...
Definition of import/export macro for library.