Addition.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_INTRINSICS_ADDITION_H_
36 #define _BLAZE_MATH_INTRINSICS_ADDITION_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
44 #include <blaze/system/Inline.h>
46 
47 
48 namespace blaze {
49 
50 //=================================================================================================
51 //
52 // INTRINSIC ADDITION OPERATORS
53 //
54 //=================================================================================================
55 
56 //*************************************************************************************************
65 #if BLAZE_AVX2_MODE
66 BLAZE_ALWAYS_INLINE simd_int8_t operator+( const simd_int8_t& a, const simd_int8_t& b )
67 {
68  return _mm256_add_epi8( a.value, b.value );
69 }
70 #elif BLAZE_SSE2_MODE
71 BLAZE_ALWAYS_INLINE simd_int8_t operator+( const simd_int8_t& a, const simd_int8_t& b )
72 {
73  return _mm_add_epi8( a.value, b.value );
74 }
75 #endif
76 //*************************************************************************************************
77 
78 
79 //*************************************************************************************************
88 #if BLAZE_AVX2_MODE
89 BLAZE_ALWAYS_INLINE simd_int16_t operator+( const simd_int16_t& a, const simd_int16_t& b )
90 {
91  return _mm256_add_epi16( a.value, b.value );
92 }
93 #elif BLAZE_SSE2_MODE
94 BLAZE_ALWAYS_INLINE simd_int16_t operator+( const simd_int16_t& a, const simd_int16_t& b )
95 {
96  return _mm_add_epi16( a.value, b.value );
97 }
98 #endif
99 //*************************************************************************************************
100 
101 
102 //*************************************************************************************************
111 #if BLAZE_MIC_MODE
112 BLAZE_ALWAYS_INLINE simd_int32_t operator+( const simd_int32_t& a, const simd_int32_t& b )
113 {
114  return _mm512_add_epi32( a.value, b.value );
115 }
116 #elif BLAZE_AVX2_MODE
117 BLAZE_ALWAYS_INLINE simd_int32_t operator+( const simd_int32_t& a, const simd_int32_t& b )
118 {
119  return _mm256_add_epi32( a.value, b.value );
120 }
121 #elif BLAZE_SSE2_MODE
122 BLAZE_ALWAYS_INLINE simd_int32_t operator+( const simd_int32_t& a, const simd_int32_t& b )
123 {
124  return _mm_add_epi32( a.value, b.value );
125 }
126 #endif
127 //*************************************************************************************************
128 
129 
130 //*************************************************************************************************
139 #if BLAZE_MIC_MODE
140 BLAZE_ALWAYS_INLINE simd_int64_t operator+( const simd_int64_t& a, const simd_int64_t& b )
141 {
142  return _mm512_add_epi64( a.value, b.value );
143 }
144 #elif BLAZE_AVX2_MODE
145 BLAZE_ALWAYS_INLINE simd_int64_t operator+( const simd_int64_t& a, const simd_int64_t& b )
146 {
147  return _mm256_add_epi64( a.value, b.value );
148 }
149 #elif BLAZE_SSE2_MODE
150 BLAZE_ALWAYS_INLINE simd_int64_t operator+( const simd_int64_t& a, const simd_int64_t& b )
151 {
152  return _mm_add_epi64( a.value, b.value );
153 }
154 #endif
155 //*************************************************************************************************
156 
157 
158 //*************************************************************************************************
167 #if BLAZE_MIC_MODE
168 BLAZE_ALWAYS_INLINE simd_float_t operator+( const simd_float_t& a, const simd_float_t& b )
169 {
170  return _mm512_add_ps( a.value, b.value );
171 }
172 #elif BLAZE_AVX_MODE
173 BLAZE_ALWAYS_INLINE simd_float_t operator+( const simd_float_t& a, const simd_float_t& b )
174 {
175  return _mm256_add_ps( a.value, b.value );
176 }
177 #elif BLAZE_SSE_MODE
178 BLAZE_ALWAYS_INLINE simd_float_t operator+( const simd_float_t& a, const simd_float_t& b )
179 {
180  return _mm_add_ps( a.value, b.value );
181 }
182 #endif
183 //*************************************************************************************************
184 
185 
186 //*************************************************************************************************
195 #if BLAZE_MIC_MODE
196 BLAZE_ALWAYS_INLINE simd_double_t operator+( const simd_double_t& a, const simd_double_t& b )
197 {
198  return _mm512_add_pd( a.value, b.value );
199 }
200 #elif BLAZE_AVX_MODE
201 BLAZE_ALWAYS_INLINE simd_double_t operator+( const simd_double_t& a, const simd_double_t& b )
202 {
203  return _mm256_add_pd( a.value, b.value );
204 }
205 #elif BLAZE_SSE2_MODE
206 BLAZE_ALWAYS_INLINE simd_double_t operator+( const simd_double_t& a, const simd_double_t& b )
207 {
208  return _mm_add_pd( a.value, b.value );
209 }
210 #endif
211 //*************************************************************************************************
212 
213 
214 //*************************************************************************************************
223 #if BLAZE_AVX2_MODE
224 BLAZE_ALWAYS_INLINE simd_cint8_t operator+( const simd_cint8_t& a, const simd_cint8_t& b )
225 {
226  return _mm256_add_epi8( a.value, b.value );
227 }
228 #elif BLAZE_SSE2_MODE
229 BLAZE_ALWAYS_INLINE simd_cint8_t operator+( const simd_cint8_t& a, const simd_cint8_t& b )
230 {
231  return _mm_add_epi8( a.value, b.value );
232 }
233 #endif
234 //*************************************************************************************************
235 
236 
237 //*************************************************************************************************
246 #if BLAZE_AVX2_MODE
247 BLAZE_ALWAYS_INLINE simd_cint16_t operator+( const simd_cint16_t& a, const simd_cint16_t& b )
248 {
249  return _mm256_add_epi16( a.value, b.value );
250 }
251 #elif BLAZE_SSE2_MODE
252 BLAZE_ALWAYS_INLINE simd_cint16_t operator+( const simd_cint16_t& a, const simd_cint16_t& b )
253 {
254  return _mm_add_epi16( a.value, b.value );
255 }
256 #endif
257 //*************************************************************************************************
258 
259 
260 //*************************************************************************************************
269 #if BLAZE_MIC_MODE
270 BLAZE_ALWAYS_INLINE simd_cint32_t operator+( const simd_cint32_t& a, const simd_cint32_t& b )
271 {
272  return _mm512_add_epi32( a.value, b.value );
273 }
274 #elif BLAZE_AVX2_MODE
275 BLAZE_ALWAYS_INLINE simd_cint32_t operator+( const simd_cint32_t& a, const simd_cint32_t& b )
276 {
277  return _mm256_add_epi32( a.value, b.value );
278 }
279 #elif BLAZE_SSE2_MODE
280 BLAZE_ALWAYS_INLINE simd_cint32_t operator+( const simd_cint32_t& a, const simd_cint32_t& b )
281 {
282  return _mm_add_epi32( a.value, b.value );
283 }
284 #endif
285 //*************************************************************************************************
286 
287 
288 //*************************************************************************************************
297 #if BLAZE_MIC_MODE
298 BLAZE_ALWAYS_INLINE simd_cint64_t operator+( const simd_cint64_t& a, const simd_cint64_t& b )
299 {
300  return _mm512_add_epi64( a.value, b.value );
301 }
302 #elif BLAZE_AVX2_MODE
303 BLAZE_ALWAYS_INLINE simd_cint64_t operator+( const simd_cint64_t& a, const simd_cint64_t& b )
304 {
305  return _mm256_add_epi64( a.value, b.value );
306 }
307 #elif BLAZE_SSE2_MODE
308 BLAZE_ALWAYS_INLINE simd_cint64_t operator+( const simd_cint64_t& a, const simd_cint64_t& b )
309 {
310  return _mm_add_epi64( a.value, b.value );
311 }
312 #endif
313 //*************************************************************************************************
314 
315 
316 //*************************************************************************************************
325 #if BLAZE_MIC_MODE
326 BLAZE_ALWAYS_INLINE simd_cfloat_t operator+( const simd_cfloat_t& a, const simd_cfloat_t& b )
327 {
328  return _mm512_add_ps( a.value, b.value );
329 }
330 #elif BLAZE_AVX_MODE
331 BLAZE_ALWAYS_INLINE simd_cfloat_t operator+( const simd_cfloat_t& a, const simd_cfloat_t& b )
332 {
333  return _mm256_add_ps( a.value, b.value );
334 }
335 #elif BLAZE_SSE_MODE
336 BLAZE_ALWAYS_INLINE simd_cfloat_t operator+( const simd_cfloat_t& a, const simd_cfloat_t& b )
337 {
338  return _mm_add_ps( a.value, b.value );
339 }
340 #endif
341 //*************************************************************************************************
342 
343 
344 //*************************************************************************************************
353 #if BLAZE_MIC_MODE
354 BLAZE_ALWAYS_INLINE simd_cdouble_t operator+( const simd_cdouble_t& a, const simd_cdouble_t& b )
355 {
356  return _mm512_add_pd( a.value, b.value );
357 }
358 #elif BLAZE_AVX_MODE
359 BLAZE_ALWAYS_INLINE simd_cdouble_t operator+( const simd_cdouble_t& a, const simd_cdouble_t& b )
360 {
361  return _mm256_add_pd( a.value, b.value );
362 }
363 #elif BLAZE_SSE2_MODE
364 BLAZE_ALWAYS_INLINE simd_cdouble_t operator+( const simd_cdouble_t& a, const simd_cdouble_t& b )
365 {
366  return _mm_add_pd( a.value, b.value );
367 }
368 #endif
369 //*************************************************************************************************
370 
371 } // namespace blaze
372 
373 #endif
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
const DenseIterator< Type, AF > operator+(const DenseIterator< Type, AF > &it, ptrdiff_t inc)
Addition between a DenseIterator and an integral value.
Definition: DenseIterator.h:610
Header file for the basic intrinsic types.
System settings for the SSE mode.
System settings for the inline keywords.