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_AVX512_BITWISESELECTREG_H__
16 #define __IPSDKUTIL_INSTRUCTIONSET_LOGICAL_DETAIL_AVX512_BITWISESELECTREG_H__
17 
23 
24 #include <boost/type_traits/is_integral.hpp>
25 
26 namespace ipsdk {
27 namespace simd {
28 namespace detail {
29 
32 
34 template <typename T>
36 {
37  static IPSDK_FORCEINLINE
38  typename Avx512Type<T>::Type
39  act(const typename Avx512Type<T>::Type& mask,
40  const typename Avx512Type<T>::Type& in1,
41  const typename Avx512Type<T>::Type& in2)
42  {
43  typename Avx512Type<T>::Type in2AndNotMask =
45 
46  typename Avx512Type<T>::Type out =
49  in2AndNotMask);
50 
51  return out;
52  }
53 
54  static IPSDK_FORCEINLINE
55  void
56  act(const typename Avx512Type<T>::Type& mask,
57  const typename Avx512Type<T>::Type& in1,
58  const typename Avx512Type<T>::Type& in2,
59  typename Avx512Type<T>::Type& out)
60  {
61  typename Avx512Type<T>::Type in2AndNotMask, in1AndMask;
64  BitwiseOrReg<eInstructionSet::eIS_Avx512, T>::act(in1AndMask, in2AndNotMask, out);
65  }
66 };
67 /*template <typename T>
68 struct BitwiseSelectReg<eInstructionSet::eIS_Avx512, T, typename boost::enable_if<typename boost::is_integral<T>::type>::type>
69 {
70  static IPSDK_FORCEINLINE
71  typename Avx512Type<T>::Type
72  act(const typename Avx512Type<T>::Type& mask,
73  const typename Avx512Type<T>::Type& in1,
74  const typename Avx512Type<T>::Type& in2)
75  {
76  return _mm512_ternarylogic_epi32(in2, in1, mask, 0xe4);
77  }
78 
79  static IPSDK_FORCEINLINE
80  void
81  act(const typename Avx512Type<T>::Type& mask,
82  const typename Avx512Type<T>::Type& in1,
83  const typename Avx512Type<T>::Type& in2,
84  typename Avx512Type<T>::Type& out)
85  {
86  out = _mm512_ternarylogic_epi32(in2, in1, mask, 0xe4);
87  }
88 };
89 
90 template <>
91 struct BitwiseSelectReg<eInstructionSet::eIS_Avx512, ipReal32>
92 {
93  static IPSDK_FORCEINLINE
94  Avx512Type<ipReal32>::Type
95  act(const Avx512Type<ipReal32>::Type& mask,
96  const Avx512Type<ipReal32>::Type& in1,
97  const Avx512Type<ipReal32>::Type& in2)
98  {
99  return _mm512_mask_blend_ps(
100  _mm512_cmp_ps_mask(in1, in2, _MM_CMPINT_EQ),
101  in2,
102  in1);
103  }
104 
105  static IPSDK_FORCEINLINE
106  void
107  act(const Avx512Type<ipReal32>::Type& mask,
108  const Avx512Type<ipReal32>::Type& in1,
109  const Avx512Type<ipReal32>::Type& in2,
110  Avx512Type<ipReal32>::Type& out)
111  {
112  out = _mm512_mask_blend_ps(
113  _mm512_cmp_ps_mask(in1, in2, _MM_CMPINT_EQ),
114  in2,
115  in1);
116  }
117 };
118 
119 template <>
120 struct BitwiseSelectReg<eInstructionSet::eIS_Avx512, ipReal64>
121 {
122  static IPSDK_FORCEINLINE
123  Avx512Type<ipReal64>::Type
124  act(const Avx512Type<ipReal64>::Type& mask,
125  const Avx512Type<ipReal64>::Type& in1,
126  const Avx512Type<ipReal64>::Type& in2)
127  {
128  return _mm512_mask_blend_pd(
129  _mm512_cmp_pd_mask(in1, in2, _MM_CMPINT_EQ),
130  in2,
131  in1);
132  }
133 
134  static IPSDK_FORCEINLINE
135  void
136  act(const Avx512Type<ipReal64>::Type& mask,
137  const Avx512Type<ipReal64>::Type& in1,
138  const Avx512Type<ipReal64>::Type& in2,
139  Avx512Type<ipReal64>::Type& out)
140  {
141  out = _mm512_mask_blend_pd(
142  _mm512_cmp_pd_mask(in1, in2, _MM_CMPINT_EQ),
143  in2,
144  in1);
145  }
146 };*/
147 
150 
151 } // end of namespace detail
152 } // end of namespace simd
153 } // end of namespace ipsdk
154 
155 #endif // __IPSDKUTIL_INSTRUCTIONSET_LOGICAL_DETAIL_AVX512_BITWISESELECTREG_H__
Defines the IPSDK_FORCEINLINE.
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
Definition: BitwiseAndNotReg.h:30
(including fundation and byte and word instructions)
Definition: InstructionSetTypes.h:51
Definition: BitwiseSelectReg.h:30
eInstructionSet
Enumerate for processor instruction set description.
Definition: InstructionSetTypes.h:31
Definition: BitwiseOrReg.h:30
Definition of import/export macro for library.
Definition: BitwiseAndReg.h:30
structure used to retrieve AVX512 type associated to a base type
Definition: Avx512Types.h:36