IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
IsGreaterRegImpl.h
Go to the documentation of this file.
1 // IsGreaterRegImpl.h:
3 // -------------------
4 //
14 
15 #ifndef __IPSDKUTIL_INSTRUCTIONSET_COMPARISON_DETAIL_AVX512_ISGREATERREGIMPL_H__
16 #define __IPSDKUTIL_INSTRUCTIONSET_COMPARISON_DETAIL_AVX512_ISGREATERREGIMPL_H__
17 
22 
23 namespace ipsdk {
24 namespace simd {
25 namespace detail {
26 
29 
30 #define DEFINE_ISGREATERREG_INT(nbBitsInInt, nbBitsInMask) \
31 template <> \
32 struct IsGreaterReg<eInstructionSet::eIS_Avx512, ipInt ## nbBitsInInt> \
33 { \
34  static IPSDK_FORCEINLINE \
35  __mmask ## nbBitsInMask \
36  act(const Avx512Type<ipInt ## nbBitsInInt>::Type& in1, \
37  const Avx512Type<ipInt ## nbBitsInInt>::Type& in2) \
38  { \
39  return _mm512_cmp_epi ## nbBitsInInt ## _mask(in1, in2, _MM_CMPINT_GT); \
40  } \
41  static IPSDK_FORCEINLINE \
42  void \
43  act(const Avx512Type<ipInt ## nbBitsInInt>::Type& in1, \
44  const Avx512Type<ipInt ## nbBitsInInt>::Type& in2, \
45  __mmask ## nbBitsInMask &out) \
46  { \
47  out = _mm512_cmp_epi ## nbBitsInInt ## _mask(in1, in2, _MM_CMPINT_GT); \
48  } \
49 };
50 
51 #define DEFINE_ISGREATERREG_UINT(nbBitsInInt, nbBitsInMask) \
52 template <> \
53 struct IsGreaterReg<eInstructionSet::eIS_Avx512, ipUInt ## nbBitsInInt> \
54 { \
55  static IPSDK_FORCEINLINE \
56  __mmask ## nbBitsInMask \
57  act(const Avx512Type<ipUInt ## nbBitsInInt>::Type& in1, \
58  const Avx512Type<ipUInt ## nbBitsInInt>::Type& in2) \
59  { \
60  return _mm512_cmp_epu ## nbBitsInInt ## _mask(in1, in2, _MM_CMPINT_GT); \
61  } \
62  \
63  static IPSDK_FORCEINLINE \
64  void \
65  act(const Avx512Type<ipUInt ## nbBitsInInt>::Type& in1, \
66  const Avx512Type<ipUInt ## nbBitsInInt>::Type& in2, \
67  __mmask ## nbBitsInMask &out) \
68  { \
69  out = _mm512_cmp_epu ## nbBitsInInt ## _mask(in1, in2, _MM_CMPINT_GT); \
70  } \
71 };
72 
73 DEFINE_ISGREATERREG_INT(8, 64)
74 DEFINE_ISGREATERREG_UINT(8, 64)
75 DEFINE_ISGREATERREG_INT(16, 32)
76 DEFINE_ISGREATERREG_UINT(16, 32)
77 DEFINE_ISGREATERREG_INT(32, 16)
78 DEFINE_ISGREATERREG_UINT(32, 16)
79 DEFINE_ISGREATERREG_INT(64, 8)
80 DEFINE_ISGREATERREG_UINT(64, 8)
81 
82 template <>
84 {
85  static IPSDK_FORCEINLINE
86  __mmask16
87  act(const Avx512Type<ipReal32>::Type& in1,
88  const Avx512Type<ipReal32>::Type& in2)
89  {
90  return _mm512_cmp_ps_mask(in1, in2, _MM_CMPINT_GT);
91  }
92 
93  static IPSDK_FORCEINLINE
94  void
95  act(const Avx512Type<ipReal32>::Type& in1,
96  const Avx512Type<ipReal32>::Type& in2,
97  __mmask16& out)
98  {
99  out = _mm512_cmp_ps_mask(in1, in2, _MM_CMPINT_GT);
100  }
101 };
102 
103 template <>
105 {
106  static IPSDK_FORCEINLINE
107  __mmask8
108  act(const Avx512Type<ipReal64>::Type& in1,
109  const Avx512Type<ipReal64>::Type& in2)
110  {
111  return _mm512_cmp_pd_mask(in1, in2, _MM_CMPINT_GT);
112  }
113 
114  static IPSDK_FORCEINLINE
115  void
116  act(const Avx512Type<ipReal64>::Type& in1,
117  const Avx512Type<ipReal64>::Type& in2,
118  __mmask8& out)
119  {
120  out = _mm512_cmp_pd_mask(in1, in2, _MM_CMPINT_GT);
121  }
122 };
123 
126 
127 } // end of namespace detail
128 } // end of namespace simd
129 } // end of namespace ipsdk
130 
131 #endif // __IPSDKUTIL_INSTRUCTIONSET_COMPARISON_DETAIL_AVX512_ISGREATERREGIMPL_H__
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
Definition: IsGreaterRegDecl.h:30
double ipReal64
Base types definition.
Definition: BaseTypes.h:57
(including fundation and byte and word instructions)
Definition: InstructionSetTypes.h:51
eInstructionSet
Enumerate for processor instruction set description.
Definition: InstructionSetTypes.h:31
float ipReal32
Base types definition.
Definition: BaseTypes.h:56
structure used to retrieve AVX512 type associated to a base type
Definition: Avx512Types.h:36