IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
ToBoolPack.h
Go to the documentation of this file.
1 // ToBoolPack.h:
3 // -------------------
4 //
14 
15 #ifndef __IPSDKUTIL_INSTRUCTIONSET_LOGICAL_DETAIL_AVX512_TOBOOLPACK_H__
16 #define __IPSDKUTIL_INSTRUCTIONSET_LOGICAL_DETAIL_AVX512_TOBOOLPACK_H__
17 
23 
24 namespace ipsdk {
25 namespace simd {
26 namespace detail {
27 
30 
31 template <>
33 {
34  static IPSDK_FORCEINLINE
37  {
39  act(in, out);
40  return out;
41  }
42 
43  static IPSDK_FORCEINLINE
44  void
47  {
50  assign<eInstructionSet::eIS_Avx512>(zero, 0);
51  assign<eInstructionSet::eIS_Avx512>(one, 1);
52  isNotEqual<eInstructionSet::eIS_Avx512>(in, zero, nez);
53  cast<eInstructionSet::eIS_Avx512>(nez, out);
54  bitwiseAnd<eInstructionSet::eIS_Avx512>(out, one, out);
55  }
56 
57  static IPSDK_FORCEINLINE
58  void
61  {
63  cast<eInstructionSet::eIS_Avx512>(inMask, in);
64  act(in, out);
65  }
66 };
67 
68 template <>
70 {
71  static IPSDK_FORCEINLINE
74  {
76  act(in, out);
77  return out;
78  }
79 
80  static IPSDK_FORCEINLINE
81  void
84  {
87  assign<eInstructionSet::eIS_Avx512>(zero, 0);
88  assign<eInstructionSet::eIS_Avx512>(one, 1);
90  isNotEqual<eInstructionSet::eIS_Avx512>(in, zero, nez);
91  cast<eInstructionSet::eIS_Avx512>(nez, packInt8);
92  bitwiseAnd<eInstructionSet::eIS_Avx512>(packInt8, one, packInt8);
93 
94  cast<eInstructionSet::eIS_Avx512>(packInt8, out);
95  }
96 
97  static IPSDK_FORCEINLINE
98  void
101  {
103  cast<eInstructionSet::eIS_Avx512>(inMask, in);
104  act(in, out);
105  }
106 };
107 
108 template <typename T>
110  typename boost::enable_if_c<
111  boost::is_integral<T>::value && sizeof(T) != 1>::type>
112 {
113  static IPSDK_FORCEINLINE
116  {
118  act(in, out);
119  }
120 
121  static IPSDK_FORCEINLINE
122  void
125  {
128  assign<eInstructionSet::eIS_Avx512>(zero, 0);
129  assign<eInstructionSet::eIS_Avx512>(one, 1);
130 
132  isNotEqual<eInstructionSet::eIS_Avx512>(in, zero, nez);
133  cast<eInstructionSet::eIS_Avx512>(nez, packT);
134  bitwiseAnd<eInstructionSet::eIS_Avx512>(packT, one, packT);
135 
136  cast<eInstructionSet::eIS_Avx512>(packT, out);
137  }
138 
139  static IPSDK_FORCEINLINE
140  void
141  act(const BaseMaskPack<ePackType::ePT_Avx512, T>& inMask,
143  {
145  cast<eInstructionSet::eIS_Avx512>(inMask, in);
146  act(in, out);
147  }
148 };
149 
150 template <>
152 {
153  static IPSDK_FORCEINLINE
156  {
158  act(in, out);
159  }
160 
161  static IPSDK_FORCEINLINE
162  void
165  {
167  inCvt._val[0] = _mm512_castps_si512(in._val[0]);
168  inCvt._val[1] = _mm512_castps_si512(in._val[1]);
169  inCvt._val[2] = _mm512_castps_si512(in._val[2]);
170  inCvt._val[3] = _mm512_castps_si512(in._val[3]);
171 
173  }
174 
175  static IPSDK_FORCEINLINE
176  void
179  {
181  cast<eInstructionSet::eIS_Avx512>(inMask, in);
182  act(in, out);
183  }
184 };
185 
188 
189 } // end of namespace detail
190 } // end of namespace simd
191 } // end of namespace ipsdk
192 
193 #endif // __IPSDKUTIL_INSTRUCTIONSET_LOGICAL_DETAIL_AVX2_TOBOOLPACK_H__
int8_t ipInt8
Base types definition.
Definition: BaseTypes.h:48
Defines the IPSDK_FORCEINLINE.
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
structure containing set of masks for vectorized operations
Definition: BaseMaskPackDecl.h:29
(including fundation and byte and word instructions)
Definition: InstructionSetTypes.h:51
uint8_t ipUInt8
Base types definition.
Definition: BaseTypes.h:49
eInstructionSet
Enumerate for processor instruction set description.
Definition: InstructionSetTypes.h:31
Predefined types for Avx512 instruction set management.
Definition: ToBoolPack.h:30
Definition of import/export macro for library.
float ipReal32
Base types definition.
Definition: BaseTypes.h:56
structure containing intrinsic registers used to store vectorized data
Definition: BasePackDecl.h:29