IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
BitwiseCastReg.h
Go to the documentation of this file.
1 // BitwiseCastReg.h:
3 // ------------
4 //
14 
15 #ifndef __IPSDKUTIL_INSTRUCTIONSET_DETAIL_AVX2_BITWISECASTREG_H__
16 #define __IPSDKUTIL_INSTRUCTIONSET_DETAIL_AVX2_BITWISECASTREG_H__
17 
22 
23 #include <boost/mpl/and.hpp>
24 #include <boost/mpl/sizeof.hpp>
25 
26 namespace ipsdk {
27 namespace simd {
28 namespace detail {
29 
32 
33 template <typename TIn>
36  TIn,
37  ipReal32,
38  typename boost::enable_if<
39  typename boost::mpl::and_<
40  typename boost::mpl::equal_to<
41  boost::mpl::sizeof_<TIn>,
42  boost::mpl::int_<4>
43  >::type,
44  typename boost::is_integral<TIn>::type
45  >::type
46  >::type
47 >
48 {
49 
50  static IPSDK_FORCEINLINE
52  act(const typename AvxType<TIn>::Type& in)
53  {
54  return _mm256_castsi256_ps(in);
55  }
56 
57  static IPSDK_FORCEINLINE
58  void
59  act(const typename AvxType<TIn>::Type& in,
60  typename AvxType<ipReal32>::Type& out)
61  {
62  out = _mm256_castsi256_ps(in);
63  }
64 };
65 
66 template <typename TOut>
68  ipReal32,
69  TOut,
70  typename boost::enable_if<
71  typename boost::mpl::and_<
72  typename boost::mpl::equal_to<
73  boost::mpl::sizeof_<TOut>,
74  boost::mpl::int_<4>
75  >::type,
76  typename boost::is_integral<TOut>::type
77  >::type
78  >::type
79 >
80 {
81 
82  static IPSDK_FORCEINLINE
83  typename AvxType<TOut>::Type act(const typename AvxType<ipReal32>::Type& in)
84  {
85  return _mm256_castps_si256(in);
86  }
87 
88  static IPSDK_FORCEINLINE
89  void
90  act(const typename AvxType<ipReal32>::Type& in,
91  typename AvxType<TOut>::Type& out)
92  {
93  out = _mm256_castps_si256(in);
94  }
95 };
96 
97 template <typename TIn>
100  TIn,
101  ipReal64,
102  typename boost::enable_if<
103  typename boost::mpl::and_<
104  typename boost::mpl::equal_to<
105  boost::mpl::sizeof_<TIn>,
106  boost::mpl::int_<8>
107  >::type,
108  typename boost::is_integral<TIn>::type
109  >::type
110  >::type
111 >
112 {
113 
114  static IPSDK_FORCEINLINE
115  typename AvxType<ipReal64>::Type
116  act(const typename AvxType<TIn>::Type& in)
117  {
118  return _mm256_castsi256_pd(in);
119  }
120 
121  static IPSDK_FORCEINLINE
122  void
123  act(const typename AvxType<TIn>::Type& in,
124  typename AvxType<ipReal64>::Type& out)
125  {
126  out = _mm256_castsi256_pd(in);
127  }
128 };
129 
130 template <typename TOut>
132  ipReal64,
133  TOut,
134  typename boost::enable_if<
135  typename boost::mpl::and_<
136  typename boost::mpl::equal_to<
137  boost::mpl::sizeof_<TOut>,
138  boost::mpl::int_<8>
139  >::type,
140  typename boost::is_integral<TOut>::type
141  >::type
142  >::type
143 >
144 {
145 
146  static IPSDK_FORCEINLINE
147  typename AvxType<TOut>::Type act(const typename AvxType<ipReal64>::Type& in)
148  {
149  return _mm256_castpd_si256(in);
150  }
151 
152  static IPSDK_FORCEINLINE
153  void
154  act(const typename AvxType<ipReal64>::Type& in,
155  typename AvxType<TOut>::Type& out)
156  {
157  out = _mm256_castpd_si256(in);
158  }
159 };
162 
163 } // end of namespace detail
164 } // end of namespace simd
165 } // end of namespace ipsdk
166 
167 #endif // __IPSDKUTIL_INSTRUCTIONSET_DETAIL_AVX2_BITWISECASTREG_H__
Defines the IPSDK_FORCEINLINE.
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
double ipReal64
Base types definition.
Definition: BaseTypes.h:57
Predefined types for Avx instruction set management.
eInstructionSet
Enumerate for processor instruction set description.
Definition: InstructionSetTypes.h:31
Advanced Vector Extensions 2.
Definition: InstructionSetTypes.h:48
Definition of import/export macro for library.
Definition: BitwiseCastReg.h:29
structure used to retrieve AVX type associated to a base type
Definition: AvxTypes.h:33
float ipReal32
Base types definition.
Definition: BaseTypes.h:56