IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
IfElseReg.h
Go to the documentation of this file.
1 // IfElseReg.h:
3 // -------------------
4 //
14 
15 #ifndef __IPSDKUTIL_INSTRUCTIONSET_LOGICAL_DETAIL_AVX_IFELSEREG_H__
16 #define __IPSDKUTIL_INSTRUCTIONSET_LOGICAL_DETAIL_AVX_IFELSEREG_H__
17 
22 
23 namespace ipsdk {
24 namespace simd {
25 namespace detail {
26 
29 
30 template <typename T>
31 struct IfElseReg<
33  T,
34  typename boost::enable_if_c<boost::is_integral<T>::value>::type
35 >
36 {
37  static IPSDK_FORCEINLINE
38  typename AvxType<T>::Type
39  act(const typename AvxMaskType<T>::Type& mask,
40  const typename AvxType<T>::Type& in1,
41  const typename AvxType<T>::Type& in2)
42  {
43  typename AvxType<T>::Type regFromMask;
45  typename AvxType<T>::Type out;
46 
47  BitwiseSelectReg<eInstructionSet::eIS_Avx, T>::act(regFromMask, in1, in2, out);
48  return out;
49  }
50 
51  static IPSDK_FORCEINLINE
52  void
53  act(const typename AvxMaskType<T>::Type& mask,
54  const typename AvxType<T>::Type& in1,
55  const typename AvxType<T>::Type& in2,
56  typename AvxType<T>::Type& out)
57  {
58  typename AvxType<T>::Type regFromMask;
60  BitwiseSelectReg<eInstructionSet::eIS_Avx, T>::act(regFromMask, in1, in2, out);
61  }
62 };
63 
64 template <>
66 {
67  static IPSDK_FORCEINLINE
69  act(const AvxMaskType<ipReal32>::Type& mask,
70  const AvxType<ipReal32>::Type& in1,
71  const AvxType<ipReal32>::Type& in2)
72  {
73  AvxType<ipReal32>::Type regFromMask;
76 
77  out = _mm256_blendv_ps(in2, in1, regFromMask);
78  }
79 
80  static IPSDK_FORCEINLINE
81  void
82  act(const AvxMaskType<ipReal32>::Type& mask,
83  const AvxType<ipReal32>::Type& in1,
84  const AvxType<ipReal32>::Type& in2,
86  {
87  AvxType<ipReal32>::Type regFromMask;
89 
90  out = _mm256_blendv_ps(in2, in1, regFromMask);
91  }
92 };
93 
94 template <>
96 {
97  static IPSDK_FORCEINLINE
99  act(const AvxMaskType<ipReal64>::Type& mask,
100  const AvxType<ipReal64>::Type& in1,
101  const AvxType<ipReal64>::Type& in2)
102  {
103  AvxType<ipReal64>::Type regFromMask;
106 
107  out = _mm256_blendv_pd(in2, in1, regFromMask);
108  }
109 
110  static IPSDK_FORCEINLINE
111  void
112  act(const AvxMaskType<ipReal64>::Type& mask,
113  const AvxType<ipReal64>::Type& in1,
114  const AvxType<ipReal64>::Type& in2,
116  {
117  AvxType<ipReal64>::Type regFromMask;
119 
120  out = _mm256_blendv_pd(in2, in1, regFromMask);
121  }
122 };
123 
126 
127 } // end of namespace detail
128 } // end of namespace simd
129 } // end of namespace ipsdk
130 
131 #endif // __IPSDKUTIL_INSTRUCTIONSET_LOGICAL_DETAIL_AVX_IFELSEREG_H__
structure used to retrieve AVX mask type associated to a base type
Definition: AvxMaskTypes.h:33
Defines the IPSDK_FORCEINLINE.
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
double ipReal64
Base types definition.
Definition: BaseTypes.h:57
Definition: CastReg.h:30
Definition: BitwiseSelectReg.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.
Definition: IfElseReg.h:33
structure used to retrieve AVX type associated to a base type
Definition: AvxTypes.h:33
float ipReal32
Base types definition.
Definition: BaseTypes.h:56