IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
MaxReg.h
Go to the documentation of this file.
1 // MaxReg.h:
3 // -------------------
4 //
14 
15 #ifndef __IPSDKUTIL_INSTRUCTIONSET_REDUCTION_DETAIL_AVX512_MAXREG_H__
16 #define __IPSDKUTIL_INSTRUCTIONSET_REDUCTION_DETAIL_AVX512_MAXREG_H__
17 
21 
22 namespace ipsdk {
23 namespace simd {
24 namespace detail {
25 namespace reduction {
26 
29 
32 template <typename T>
34  typename boost::enable_if_c<sizeof(T) == 1>::type>
35 {
36  static IPSDK_FORCEINLINE
37  T
38  act(const typename Avx512Type<T>::Type& in)
39  {
40  T unloaded[64];
42  T tmax = unloaded[0];
43  for(int i=1; i<64; ++i) {
44  tmax = (unloaded[i] > tmax ? unloaded[i] : tmax);
45  }
46  return tmax;
47  }
48 };
49 
52 template <typename T>
54  typename boost::enable_if_c<sizeof(T) == 2>::type>
55 {
56  static IPSDK_FORCEINLINE
57  T
58  act(const typename Avx512Type<T>::Type& in)
59  {
60  T unloaded[32];
62  T tmax = unloaded[0];
63  for(int i=1; i<32; ++i) {
64  tmax = (unloaded[i] > tmax ? unloaded[i] : tmax);
65  }
66  return tmax;
67  }
68 };
69 
72 template <>
74 {
75  static IPSDK_FORCEINLINE
76  ipInt32
77  act(const Avx512Type<ipInt32>::Type& in)
78  {
79  return _mm512_reduce_max_epi32(in);
80  }
81 };
82 
85 template <>
87 {
88  static IPSDK_FORCEINLINE
89  ipUInt32
90  act(const Avx512Type<ipUInt32>::Type& in)
91  {
92  return _mm512_reduce_max_epu32(in);
93  }
94 };
95 
98 template <>
100 {
101  static IPSDK_FORCEINLINE
102  ipInt64
103  act(const Avx512Type<ipInt64>::Type& in)
104  {
105  return _mm512_reduce_max_epi64(in);
106  }
107 };
108 
111 template <>
113 {
114  static IPSDK_FORCEINLINE
115  ipUInt64
116  act(const Avx512Type<ipUInt64>::Type& in)
117  {
118  return _mm512_reduce_max_epu64(in);
119  }
120 };
121 
124 template <>
126 {
127  static IPSDK_FORCEINLINE
128  ipReal32
129  act(const Avx512Type<ipReal32>::Type& in)
130  {
131  return _mm512_reduce_max_ps(in);
132  }
133 };
134 
137 template <>
139 {
140  static IPSDK_FORCEINLINE
141  ipReal64
142  act(const Avx512Type<ipReal64>::Type& in)
143  {
144  return _mm512_reduce_max_pd(in);
145  }
146 };
147 
150 
151 } // end of namespace reduction
152 } // end of namespace detail
153 } // end of namespace simd
154 } // end of namespace ipsdk
155 
156 #endif // __IPSDKUTIL_INSTRUCTIONSET_REDUCTION_DETAIL_AVX512_MAXREGIMPL_H__
Defines the IPSDK_FORCEINLINE.
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
cast function; casts a Pack<instructionSet, TIn> to a Pack<instructionSet, TOut>
uint64_t ipUInt64
Base types definition.
Definition: BaseTypes.h:55
double ipReal64
Base types definition.
Definition: BaseTypes.h:57
int32_t ipInt32
Base types definition.
Definition: BaseTypes.h:52
(including fundation and byte and word instructions)
Definition: InstructionSetTypes.h:51
eInstructionSet
Enumerate for processor instruction set description.
Definition: InstructionSetTypes.h:31
Definition of import/export macro for library.
int64_t ipInt64
Base types definition.
Definition: BaseTypes.h:54
Definition: UnloadReg.h:30
float ipReal32
Base types definition.
Definition: BaseTypes.h:56
uint32_t ipUInt32
Base types definition.
Definition: BaseTypes.h:53
structure used to retrieve AVX512 type associated to a base type
Definition: Avx512Types.h:36