IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
IsLessRegImpl.h
1 // IsLessRegImpl.h:
3 // -------------------
4 //
14 
15 #ifndef __IPSDKUTIL_INSTRUCTIONSET_COMPARISON_DETAIL_AVX512_ISLESSREGIMPL_H__
16 #define __IPSDKUTIL_INSTRUCTIONSET_COMPARISON_DETAIL_AVX512_ISLESSREGIMPL_H__
17 
19 
20 namespace ipsdk {
21 namespace simd {
22 namespace detail {
23 
26 
27 #define DEFINE_ISLESSREG_INT(nbBitsInInt) \
28 template <> \
29 IPSDK_FORCEINLINE \
30 RegMaskType<eInstructionSet::eIS_Avx512, ipInt ## nbBitsInInt>::Type \
31 IsLessReg<eInstructionSet::eIS_Avx512, ipInt ## nbBitsInInt>::act( \
32  const Avx512Type<ipInt ## nbBitsInInt>::Type& in1, \
33  const Avx512Type<ipInt ## nbBitsInInt>::Type& in2) \
34 { \
35  return _mm512_cmp_epi ## nbBitsInInt ## _mask(in1, in2, _MM_CMPINT_LT); \
36 } \
37 template <> \
38 IPSDK_FORCEINLINE \
39 void \
40 IsLessReg<eInstructionSet::eIS_Avx512, ipInt ## nbBitsInInt>::act( \
41  const Avx512Type<ipInt ## nbBitsInInt>::Type& in1, \
42  const Avx512Type<ipInt ## nbBitsInInt>::Type& in2, \
43  RegMaskType<eInstructionSet::eIS_Avx512, ipInt ## nbBitsInInt>::Type& out) \
44 { \
45  out = _mm512_cmp_epi ## nbBitsInInt ## _mask(in1, in2, _MM_CMPINT_LT); \
46 }
47 
48 #define DEFINE_ISLESSREG_UINT(nbBitsInInt) \
49 template <> \
50 IPSDK_FORCEINLINE \
51 RegMaskType<eInstructionSet::eIS_Avx512, ipUInt ## nbBitsInInt>::Type \
52 IsLessReg<eInstructionSet::eIS_Avx512, ipUInt ## nbBitsInInt>::act( \
53  const Avx512Type<ipInt ## nbBitsInInt>::Type& in1, \
54  const Avx512Type<ipInt ## nbBitsInInt>::Type& in2) \
55 { \
56  return _mm512_cmp_epu ## nbBitsInInt ## _mask(in1, in2, _MM_CMPINT_LT); \
57 } \
58 template <> \
59 IPSDK_FORCEINLINE \
60 void \
61 IsLessReg<eInstructionSet::eIS_Avx512, ipUInt ## nbBitsInInt>::act( \
62  const Avx512Type<ipUInt ## nbBitsInInt>::Type& in1, \
63  const Avx512Type<ipUInt ## nbBitsInInt>::Type& in2, \
64  RegMaskType<eInstructionSet::eIS_Avx512, ipUInt ## nbBitsInInt>::Type& out) \
65 { \
66  out = _mm512_cmp_epu ## nbBitsInInt ## _mask(in1, in2, _MM_CMPINT_LT); \
67 }
68 
69 DEFINE_ISLESSREG_INT(8)
70 DEFINE_ISLESSREG_UINT(8)
71 DEFINE_ISLESSREG_INT(16)
72 DEFINE_ISLESSREG_UINT(16)
73 DEFINE_ISLESSREG_INT(32)
74 DEFINE_ISLESSREG_UINT(32)
75 DEFINE_ISLESSREG_INT(64)
76 DEFINE_ISLESSREG_UINT(64)
77 
78 template <>
79 IPSDK_FORCEINLINE
80 __mmask16
81 IsLessReg<eInstructionSet::eIS_Avx512, ipReal32>::act(
82  const Avx512Type<ipReal32>::Type& in1,
83  const Avx512Type<ipReal32>::Type& in2)
84 {
85  return _mm512_cmp_ps_mask(in1, in2, _MM_CMPINT_LT);
86 }
87 
88 template <>
89 IPSDK_FORCEINLINE
90 void
91 IsLessReg<eInstructionSet::eIS_Avx512, ipReal32>::act(
92  const Avx512Type<ipReal32>::Type& in1,
93  const Avx512Type<ipReal32>::Type& in2,
94  __mmask16& out)
95 {
96  out = _mm512_cmp_ps_mask(in1, in2, _MM_CMPINT_LT);
97 }
98 
99 template <>
100 IPSDK_FORCEINLINE
101 __mmask8
102 IsLessReg<eInstructionSet::eIS_Avx512, ipReal64>::act(
103  const Avx512Type<ipReal64>::Type& in1,
104  const Avx512Type<ipReal64>::Type& in2)
105 {
106  return _mm512_cmp_pd_mask(in1, in2, _MM_CMPINT_LT);
107 }
108 
109 template <>
110 IPSDK_FORCEINLINE
111 void
112 IsLessReg<eInstructionSet::eIS_Avx512, ipReal64>::act(
113  const Avx512Type<ipReal64>::Type& in1,
114  const Avx512Type<ipReal64>::Type& in2,
115  __mmask8& out)
116 {
117  out = _mm512_cmp_pd_mask(in1, in2, _MM_CMPINT_LT);
118 }
119 
122 
123 } // end of namespace detail
124 } // end of namespace simd
125 } // end of namespace ipsdk
126 
127 #endif // __IPSDKUTIL_INSTRUCTIONSET_COMPARISON_DETAIL_AVX512_ISLESSREGIMPL_H__
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
(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