IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
CastReg.h
Go to the documentation of this file.
1 // CastReg.h:
3 // ------------
4 //
14 
15 #ifndef __IPSDKUTIL_INSTRUCTIONSET_DETAIL_AVX_CASTREG_H__
16 #define __IPSDKUTIL_INSTRUCTIONSET_DETAIL_AVX_CASTREG_H__
17 
21 
22 namespace ipsdk {
23 namespace simd {
24 namespace detail {
27 
30 template <typename TIn, typename TOut>
31 struct CastReg<eInstructionSet::eIS_Avx, TIn, TOut,
32  typename boost::enable_if_c<
33  boost::is_same<TIn, TOut>::value || (boost::is_integral<TIn>::value
34  && boost::is_integral<TOut>::value && sizeof(TIn)==sizeof(TOut))
35  >::type
36 >
37 {
38  static IPSDK_FORCEINLINE
39  void act(const typename AvxType<TIn>::Type& in,
40  typename AvxType<TOut>::Type& out)
41  {
42  out = in;
43  }
44 };
45 
48 template <>
50 {
51  static IPSDK_FORCEINLINE
52  void act(const AvxType<ipInt32>::Type& in,
54  {
55  out = _mm256_cvtepi32_ps(in);
56  }
57 };
58 
61 template <>
63 {
64  static IPSDK_FORCEINLINE
65  void act(const AvxType<ipReal32>::Type& in,
67  {
68  out = _mm256_cvttps_epi32(in);
69  }
70 };
71 
74 template <>
76 {
77  static IPSDK_FORCEINLINE
78  void act(const AvxType<ipReal64>::Type& inl,
79  const AvxType<ipReal64>::Type& inh,
81  {
82  out = _mm256_castps128_ps256(_mm256_cvtpd_ps(inl));
83  out = _mm256_insertf128_ps(out, _mm256_cvtpd_ps(inh), 1);
84  }
85 };
86 
89 template <>
91 {
92  static IPSDK_FORCEINLINE
93  void act(const AvxType<ipReal32>::Type& in,
96  {
97  outl = _mm256_cvtps_pd(_mm256_extractf128_ps(in, 0));
98  outh = _mm256_cvtps_pd(_mm256_extractf128_ps(in, 1));
99  }
100 };
101 
104 
105 } // end of namespace detail
106 } // end of namespace simd
107 } // end of namespace ipsdk
108 
109 #endif // __IPSDKUTIL_INSTRUCTIONSET_DETAIL_AVX_CASTREG_H__
Defines the IPSDK_FORCEINLINE.
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
double ipReal64
Base types definition.
Definition: BaseTypes.h:57
int32_t ipInt32
Base types definition.
Definition: BaseTypes.h:52
Definition: CastReg.h:30
eInstructionSet
Enumerate for processor instruction set description.
Definition: InstructionSetTypes.h:31
Advanced Vector Extensions.
Definition: InstructionSetTypes.h:44
Definition of import/export macro for library.
structure used to retrieve AVX type associated to a base type
Definition: AvxTypes.h:33
float ipReal32
Base types definition.
Definition: BaseTypes.h:56