IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
SubReg.h
Go to the documentation of this file.
1 // SubReg.h:
3 // -------------------
4 //
14 
15 #ifndef __IPSDKUTIL_INSTRUCTIONSET_ARITHMETIC_DETAIL_AVX512_SUBREG_H__
16 #define __IPSDKUTIL_INSTRUCTIONSET_ARITHMETIC_DETAIL_AVX512_SUBREG_H__
17 
22 
23 namespace ipsdk {
24 namespace simd {
25 namespace detail {
26 
29 
32 template <typename T>
34  typename boost::enable_if_c<boost::is_integral<T>::value
35  && sizeof(T)==1>::type>
36 {
37  static IPSDK_FORCEINLINE
38  typename Avx512Type<T>::Type
39  act(const typename Avx512Type<T>::Type& in1,
40  const typename Avx512Type<T>::Type& in2)
41  {
42  return _mm512_sub_epi8(in1, in2);
43  }
44 
45  static IPSDK_FORCEINLINE
46  void
47  act(const typename Avx512Type<T>::Type& in1,
48  const typename Avx512Type<T>::Type& in2,
49  typename Avx512Type<T>::Type& out)
50  {
51  out = _mm512_sub_epi8(in1, in2);
52  }
53 };
54 
57 template <typename T>
59  typename boost::enable_if_c<boost::is_integral<T>::value
60  && sizeof(T)==2>::type>
61 {
62  static IPSDK_FORCEINLINE
63  typename Avx512Type<T>::Type
64  act(const typename Avx512Type<T>::Type& in1,
65  const typename Avx512Type<T>::Type& in2)
66  {
67  return _mm512_sub_epi16(in1, in2);
68  }
69 
70  static IPSDK_FORCEINLINE
71  void
72  act(const typename Avx512Type<T>::Type& in1,
73  const typename Avx512Type<T>::Type& in2,
74  typename Avx512Type<T>::Type& out)
75  {
76  out = _mm512_sub_epi16(in1, in2);
77  }
78 };
79 
82 template <typename T>
84  typename boost::enable_if_c<boost::is_integral<T>::value
85  && sizeof(T)==4>::type>
86 {
87  static IPSDK_FORCEINLINE
88  typename Avx512Type<T>::Type
89  act(const typename Avx512Type<T>::Type& in1,
90  const typename Avx512Type<T>::Type& in2)
91  {
92  return _mm512_sub_epi32(in1, in2);
93  }
94 
95  static IPSDK_FORCEINLINE
96  void
97  act(const typename Avx512Type<T>::Type& in1,
98  const typename Avx512Type<T>::Type& in2,
99  typename Avx512Type<T>::Type& out)
100  {
101  out = _mm512_sub_epi32(in1, in2);
102  }
103 };
104 
107 template <typename T>
109  typename boost::enable_if_c<boost::is_integral<T>::value
110  && sizeof(T)==8>::type>
111 {
112  static IPSDK_FORCEINLINE
113  typename Avx512Type<T>::Type
114  act(const typename Avx512Type<T>::Type& in1,
115  const typename Avx512Type<T>::Type& in2)
116  {
117  return _mm512_sub_epi64(in1, in2);
118  }
119 
120  static IPSDK_FORCEINLINE
121  void
122  act(const typename Avx512Type<T>::Type& in1,
123  const typename Avx512Type<T>::Type& in2,
124  typename Avx512Type<T>::Type& out)
125  {
126  out = _mm512_sub_epi64(in1, in2);
127  }
128 };
129 
132 template <>
134 {
135  static IPSDK_FORCEINLINE
137  act(const Avx512Type<ipReal32>::Type& in1,
138  const Avx512Type<ipReal32>::Type& in2)
139  {
140  return _mm512_sub_ps(in1, in2);
141  }
142 
143  static IPSDK_FORCEINLINE
144  void
145  act(const Avx512Type<ipReal32>::Type& in1,
146  const Avx512Type<ipReal32>::Type& in2,
148  {
149  out = _mm512_sub_ps(in1, in2);
150  }
151 };
152 
155 template <>
157 {
158  static IPSDK_FORCEINLINE
160  act(const Avx512Type<ipReal64>::Type& in1,
161  const Avx512Type<ipReal64>::Type& in2)
162  {
163  return _mm512_sub_pd(in1, in2);
164  }
165 
166  static IPSDK_FORCEINLINE
167  void
168  act(const Avx512Type<ipReal64>::Type& in1,
169  const Avx512Type<ipReal64>::Type& in2,
171  {
172  out = _mm512_sub_pd(in1, in2);
173  }
174 };
175 
178 
179 } // end of namespace detail
180 } // end of namespace simd
181 } // end of namespace ipsdk
182 
183 #endif // __IPSDKUTIL_INSTRUCTIONSET_ARITHMETIC_DETAIL_AVX512_SUBREG_H__
Defines the IPSDK_FORCEINLINE.
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
Definition: SubReg.h:39
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
Predefined types for Avx512 instruction set management.
Definition of import/export macro for library.
float ipReal32
Base types definition.
Definition: BaseTypes.h:56
structure used to retrieve AVX512 type associated to a base type
Definition: Avx512Types.h:36