IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
BitwiseSelectReg.h
Go to the documentation of this file.
1 // BitwiseSelectReg.h:
3 // -------------------
4 //
14 
15 #ifndef __IPSDKUTIL_INSTRUCTIONSET_LOGICAL_DETAIL_AVX_BITWISESELECTREG_H__
16 #define __IPSDKUTIL_INSTRUCTIONSET_LOGICAL_DETAIL_AVX_BITWISESELECTREG_H__
17 
24 
25 namespace ipsdk {
26 namespace simd {
27 namespace detail {
28 
31 
32 template <typename T>
33 struct BitwiseSelectReg<eInstructionSet::eIS_Avx, T, typename boost::enable_if<typename boost::is_integral<T>::type>::type>
34 {
35  static IPSDK_FORCEINLINE
36  typename AvxType<T>::Type
37  act(const typename AvxType<T>::Type& mask,
38  const typename AvxType<T>::Type& in1,
39  const typename AvxType<T>::Type& in2)
40  {
41  typename AvxType<T>::Type in2AndNotMask =
43 
44  typename AvxType<T>::Type out =
47  in2AndNotMask);
48 
49  return out;
50  }
51 
52  static IPSDK_FORCEINLINE
53  void
54  act(const typename AvxType<T>::Type& mask,
55  const typename AvxType<T>::Type& in1,
56  const typename AvxType<T>::Type& in2,
57  typename AvxType<T>::Type& out)
58  {
59  typename AvxType<T>::Type in1AndMask, in2AndNotMask;
61  in2AndNotMask);
63  BitwiseOrReg<eInstructionSet::eIS_Avx, T>::act(in1AndMask, in2AndNotMask,
64  out);
65  }
66 };
67 
68 template <>
70 {
71  static IPSDK_FORCEINLINE
73  act(const AvxType<ipReal32>::Type& mask,
74  const AvxType<ipReal32>::Type& in1,
75  const AvxType<ipReal32>::Type& in2)
76  {
78  _mm256_blendv_ps(in2, in1, mask);
79  return out;
80  }
81 
82  static IPSDK_FORCEINLINE
83  void
84  act(const AvxType<ipReal32>::Type& mask,
85  const AvxType<ipReal32>::Type& in1,
86  const AvxType<ipReal32>::Type& in2,
88  {
89  out = _mm256_blendv_ps(in2, in1, mask);;
90  }
91 };
92 
93 template <>
95 {
96  static IPSDK_FORCEINLINE
98  act(const AvxType<ipReal64>::Type& mask,
99  const AvxType<ipReal64>::Type& in1,
100  const AvxType<ipReal64>::Type& in2)
101  {
103  _mm256_blendv_pd(in2, in1, mask);
104  return out;
105  }
106 
107  static IPSDK_FORCEINLINE
108  void
109  act(const AvxType<ipReal64>::Type& mask,
110  const AvxType<ipReal64>::Type& in1,
111  const AvxType<ipReal64>::Type& in2,
113  {
114  out = _mm256_blendv_pd(in2, in1, mask);
115  }
116 };
117 
120 
121 } // end of namespace detail
122 } // end of namespace simd
123 } // end of namespace ipsdk
124 
125 #endif // __IPSDKUTIL_INSTRUCTIONSET_LOGICAL_DETAIL_AVX_BITWISESELECTREG_H__
Defines the IPSDK_FORCEINLINE.
Functions to convert from 128 (resp. 256) bits registers to 256 (resp. 128) bits registers.
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
Definition: BitwiseAndNotReg.h:30
double ipReal64
Base types definition.
Definition: BaseTypes.h:57
Definition: BitwiseSelectReg.h:30
eInstructionSet
Enumerate for processor instruction set description.
Definition: InstructionSetTypes.h:31
Advanced Vector Extensions.
Definition: InstructionSetTypes.h:44
Definition: BitwiseOrReg.h:30
Definition of import/export macro for library.
structure used to retrieve AVX type associated to a base type
Definition: AvxTypes.h:33
Definition: BitwiseAndReg.h:30
float ipReal32
Base types definition.
Definition: BaseTypes.h:56