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_AVX2_IFELSEREG_H__
16 #define __IPSDKUTIL_INSTRUCTIONSET_LOGICAL_DETAIL_AVX2_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  static IPSDK_FORCEINLINE
37  typename AvxType<T>::Type
38  act(const typename AvxMaskType<T>::Type& mask,
39  const typename AvxType<T>::Type& in1,
40  const typename AvxType<T>::Type& in2)
41  {
42  typename AvxType<T>::Type regFromMask;
44  typename AvxType<T>::Type out;
45 
46  BitwiseSelectReg<eInstructionSet::eIS_Avx2, T>::act(regFromMask, in1, in2, out);
47  return out;
48  }
49 
50  static IPSDK_FORCEINLINE
51  void
52  act(const typename AvxMaskType<T>::Type& mask,
53  const typename AvxType<T>::Type& in1,
54  const typename AvxType<T>::Type& in2,
55  typename AvxType<T>::Type& out)
56  {
57  typename AvxType<T>::Type regFromMask;
59  BitwiseSelectReg<eInstructionSet::eIS_Avx2, T>::act(regFromMask, in1, in2, out);
60  }
61 };
62 
63 template <>
65 {
66  static IPSDK_FORCEINLINE
68  act(const AvxMaskType<ipReal32>::Type& mask,
69  const AvxType<ipReal32>::Type& in1,
70  const AvxType<ipReal32>::Type& in2)
71  {
72  AvxType<ipReal32>::Type regFromMask;
75 
76  out = _mm256_blendv_ps(in2, in1, regFromMask);
77  }
78 
79  static IPSDK_FORCEINLINE
80  void
81  act(const AvxMaskType<ipReal32>::Type& mask,
82  const AvxType<ipReal32>::Type& in1,
83  const AvxType<ipReal32>::Type& in2,
85  {
86  AvxType<ipReal32>::Type regFromMask;
88 
89  out = _mm256_blendv_ps(in2, in1, regFromMask);
90  }
91 };
92 
93 template <>
95 {
96  static IPSDK_FORCEINLINE
98  act(const AvxMaskType<ipReal64>::Type& mask,
99  const AvxType<ipReal64>::Type& in1,
100  const AvxType<ipReal64>::Type& in2)
101  {
102  AvxType<ipReal64>::Type regFromMask;
105 
106  out = _mm256_blendv_pd(in2, in1, regFromMask);
107  }
108 
109  static IPSDK_FORCEINLINE
110  void
111  act(const AvxMaskType<ipReal64>::Type& mask,
112  const AvxType<ipReal64>::Type& in1,
113  const AvxType<ipReal64>::Type& in2,
115  {
116  AvxType<ipReal64>::Type regFromMask;
118 
119  out = _mm256_blendv_pd(in2, in1, regFromMask);
120  }
121 };
122 
125 
126 } // end of namespace detail
127 } // end of namespace simd
128 } // end of namespace ipsdk
129 
130 #endif // __IPSDKUTIL_INSTRUCTIONSET_LOGICAL_DETAIL_AVX2_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 2.
Definition: InstructionSetTypes.h:48
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