Blaze 3.9
Add.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_SIMD_ADD_H_
36#define _BLAZE_MATH_SIMD_ADD_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
44#include <blaze/system/Inline.h>
46
47
48namespace blaze {
49
50//=================================================================================================
51//
52// 8-BIT INTEGRAL SIMD TYPES
53//
54//=================================================================================================
55
56//*************************************************************************************************
66template< typename T > // Type of both operands
68 operator+( const SIMDi8<T>& a, const SIMDi8<T>& b ) noexcept
69#if BLAZE_AVX512BW_MODE
70{
71 return _mm512_add_epi8( (*a).value, (*b).value );
72}
73#elif BLAZE_AVX2_MODE
74{
75 return _mm256_add_epi8( (*a).value, (*b).value );
76}
77#elif BLAZE_SSE2_MODE
78{
79 return _mm_add_epi8( (*a).value, (*b).value );
80}
81#else
82= delete;
83#endif
84//*************************************************************************************************
85
86
87//*************************************************************************************************
97template< typename T1 // Type of the left-hand side operand
98 , typename T2 > // Type of the right-hand side operand
100 operator+( const SIMDi8<T1>& a, const SIMDi8<T2>& b ) noexcept
101#if BLAZE_AVX512BW_MODE
102{
103 return _mm512_add_epi8( (*a).value, (*b).value );
104}
105#elif BLAZE_AVX2_MODE
106{
107 return _mm256_add_epi8( (*a).value, (*b).value );
108}
109#elif BLAZE_SSE2_MODE
110{
111 return _mm_add_epi8( (*a).value, (*b).value );
112}
113#else
114= delete;
115#endif
116//*************************************************************************************************
117
118
119//*************************************************************************************************
129template< typename T > // Type of both operands
131 operator+( const SIMDci8<T>& a, const SIMDci8<T>& b ) noexcept
132#if BLAZE_AVX512BW_MODE
133{
134 return _mm512_add_epi8( (*a).value, (*b).value );
135}
136#elif BLAZE_AVX2_MODE
137{
138 return _mm256_add_epi8( (*a).value, (*b).value );
139}
140#elif BLAZE_SSE2_MODE
141{
142 return _mm_add_epi8( (*a).value, (*b).value );
143}
144#else
145= delete;
146#endif
147//*************************************************************************************************
148
149
150
151
152//=================================================================================================
153//
154// 16-BIT INTEGRAL SIMD TYPES
155//
156//=================================================================================================
157
158//*************************************************************************************************
168template< typename T > // Type of both operands
170 operator+( const SIMDi16<T>& a, const SIMDi16<T>& b ) noexcept
171#if BLAZE_AVX512BW_MODE
172{
173 return _mm512_add_epi16( (*a).value, (*b).value );
174}
175#elif BLAZE_AVX2_MODE
176{
177 return _mm256_add_epi16( (*a).value, (*b).value );
178}
179#elif BLAZE_SSE2_MODE
180{
181 return _mm_add_epi16( (*a).value, (*b).value );
182}
183#else
184= delete;
185#endif
186//*************************************************************************************************
187
188
189//*************************************************************************************************
199template< typename T1 // Type of the left-hand side operand
200 , typename T2 > // Type of the right-hand side operand
202 operator+( const SIMDi16<T1>& a, const SIMDi16<T2>& b ) noexcept
203#if BLAZE_AVX512BW_MODE
204{
205 return _mm512_add_epi16( (*a).value, (*b).value );
206}
207#elif BLAZE_AVX2_MODE
208{
209 return _mm256_add_epi16( (*a).value, (*b).value );
210}
211#elif BLAZE_SSE2_MODE
212{
213 return _mm_add_epi16( (*a).value, (*b).value );
214}
215#else
216= delete;
217#endif
218//*************************************************************************************************
219
220
221//*************************************************************************************************
231template< typename T > // Type of both operands
233 operator+( const SIMDci16<T>& a, const SIMDci16<T>& b ) noexcept
234#if BLAZE_AVX512BW_MODE
235{
236 return _mm512_add_epi16( (*a).value, (*b).value );
237}
238#elif BLAZE_AVX2_MODE
239{
240 return _mm256_add_epi16( (*a).value, (*b).value );
241}
242#elif BLAZE_SSE2_MODE
243{
244 return _mm_add_epi16( (*a).value, (*b).value );
245}
246#else
247= delete;
248#endif
249//*************************************************************************************************
250
251
252
253
254//=================================================================================================
255//
256// 32-BIT INTEGRAL SIMD TYPES
257//
258//=================================================================================================
259
260//*************************************************************************************************
270template< typename T > // Type of both operands
272 operator+( const SIMDi32<T>& a, const SIMDi32<T>& b ) noexcept
273#if BLAZE_AVX512F_MODE || BLAZE_MIC_MODE
274{
275 return _mm512_add_epi32( (*a).value, (*b).value );
276}
277#elif BLAZE_AVX2_MODE
278{
279 return _mm256_add_epi32( (*a).value, (*b).value );
280}
281#elif BLAZE_SSE2_MODE
282{
283 return _mm_add_epi32( (*a).value, (*b).value );
284}
285#else
286= delete;
287#endif
288//*************************************************************************************************
289
290
291//*************************************************************************************************
301template< typename T1 // Type of the left-hand side operand
302 , typename T2 > // Type of the right-hand side operand
304 operator+( const SIMDi32<T1>& a, const SIMDi32<T2>& b ) noexcept
305#if BLAZE_AVX512F_MODE || BLAZE_MIC_MODE
306{
307 return _mm512_add_epi32( (*a).value, (*b).value );
308}
309#elif BLAZE_AVX2_MODE
310{
311 return _mm256_add_epi32( (*a).value, (*b).value );
312}
313#elif BLAZE_SSE2_MODE
314{
315 return _mm_add_epi32( (*a).value, (*b).value );
316}
317#else
318= delete;
319#endif
320//*************************************************************************************************
321
322
323//*************************************************************************************************
333template< typename T > // Type of both operands
335 operator+( const SIMDci32<T>& a, const SIMDci32<T>& b ) noexcept
336#if BLAZE_AVX512F_MODE || BLAZE_MIC_MODE
337{
338 return _mm512_add_epi32( (*a).value, (*b).value );
339}
340#elif BLAZE_AVX2_MODE
341{
342 return _mm256_add_epi32( (*a).value, (*b).value );
343}
344#elif BLAZE_SSE2_MODE
345{
346 return _mm_add_epi32( (*a).value, (*b).value );
347}
348#else
349= delete;
350#endif
351//*************************************************************************************************
352
353
354
355
356//=================================================================================================
357//
358// 64-BIT INTEGRAL SIMD TYPES
359//
360//=================================================================================================
361
362//*************************************************************************************************
372template< typename T > // Type of the left-hand side operand
374 operator+( const SIMDi64<T>& a, const SIMDi64<T>& b ) noexcept
375#if BLAZE_AVX512F_MODE || BLAZE_MIC_MODE
376{
377 return _mm512_add_epi64( (*a).value, (*b).value );
378}
379#elif BLAZE_AVX2_MODE
380{
381 return _mm256_add_epi64( (*a).value, (*b).value );
382}
383#elif BLAZE_SSE2_MODE
384{
385 return _mm_add_epi64( (*a).value, (*b).value );
386}
387#else
388= delete;
389#endif
390//*************************************************************************************************
391
392
393//*************************************************************************************************
403template< typename T1 // Type of the left-hand side operand
404 , typename T2 > // Type of the right-hand side operand
406 operator+( const SIMDi64<T1>& a, const SIMDi64<T2>& b ) noexcept
407#if BLAZE_AVX512F_MODE || BLAZE_MIC_MODE
408{
409 return _mm512_add_epi64( (*a).value, (*b).value );
410}
411#elif BLAZE_AVX2_MODE
412{
413 return _mm256_add_epi64( (*a).value, (*b).value );
414}
415#elif BLAZE_SSE2_MODE
416{
417 return _mm_add_epi64( (*a).value, (*b).value );
418}
419#else
420= delete;
421#endif
422//*************************************************************************************************
423
424
425//*************************************************************************************************
435template< typename T > // Type of both operands
437 operator+( const SIMDci64<T>& a, const SIMDci64<T>& b ) noexcept
438#if BLAZE_AVX512F_MODE || BLAZE_MIC_MODE
439{
440 return _mm512_add_epi64( (*a).value, (*b).value );
441}
442#elif BLAZE_AVX2_MODE
443{
444 return _mm256_add_epi64( (*a).value, (*b).value );
445}
446#elif BLAZE_SSE2_MODE
447{
448 return _mm_add_epi64( (*a).value, (*b).value );
449}
450#else
451= delete;
452#endif
453//*************************************************************************************************
454
455
456
457
458//=================================================================================================
459//
460// 32-BIT FLOATING POINT SIMD TYPES
461//
462//=================================================================================================
463
464//*************************************************************************************************
474template< typename T1 // Type of the left-hand side operand
475 , typename T2 > // Type of the right-hand side operand
477 operator+( const SIMDf32<T1>& a, const SIMDf32<T2>& b ) noexcept
478#if BLAZE_AVX512F_MODE || BLAZE_MIC_MODE
479{
480 return _mm512_add_ps( (*a).eval().value, (*b).eval().value );
481}
482#elif BLAZE_AVX_MODE
483{
484 return _mm256_add_ps( (*a).eval().value, (*b).eval().value );
485}
486#elif BLAZE_SSE_MODE
487{
488 return _mm_add_ps( (*a).eval().value, (*b).eval().value );
489}
490#else
491= delete;
492#endif
493//*************************************************************************************************
494
495
496//*************************************************************************************************
507 operator+( const SIMDcfloat& a, const SIMDcfloat& b ) noexcept
508#if BLAZE_AVX512F_MODE || BLAZE_MIC_MODE
509{
510 return _mm512_add_ps( a.value, b.value );
511}
512#elif BLAZE_AVX_MODE
513{
514 return _mm256_add_ps( a.value, b.value );
515}
516#elif BLAZE_SSE_MODE
517{
518 return _mm_add_ps( a.value, b.value );
519}
520#else
521= delete;
522#endif
523//*************************************************************************************************
524
525
526
527
528//=================================================================================================
529//
530// 64-BIT FLOATING POINT SIMD TYPES
531//
532//=================================================================================================
533
534//*************************************************************************************************
544template< typename T1 // Type of the left-hand side operand
545 , typename T2 > // Type of the right-hand side operand
547 operator+( const SIMDf64<T1>& a, const SIMDf64<T2>& b ) noexcept
548#if BLAZE_AVX512F_MODE || BLAZE_MIC_MODE
549{
550 return _mm512_add_pd( (*a).eval().value, (*b).eval().value );
551}
552#elif BLAZE_AVX_MODE
553{
554 return _mm256_add_pd( (*a).eval().value, (*b).eval().value );
555}
556#elif BLAZE_SSE2_MODE
557{
558 return _mm_add_pd( (*a).eval().value, (*b).eval().value );
559}
560#else
561= delete;
562#endif
563//*************************************************************************************************
564
565
566//*************************************************************************************************
577 operator+( const SIMDcdouble& a, const SIMDcdouble& b ) noexcept
578#if BLAZE_AVX512F_MODE || BLAZE_MIC_MODE
579{
580 return _mm512_add_pd( a.value, b.value );
581}
582#elif BLAZE_AVX_MODE
583{
584 return _mm256_add_pd( a.value, b.value );
585}
586#elif BLAZE_SSE2_MODE
587{
588 return _mm_add_pd( a.value, b.value );
589}
590#else
591= delete;
592#endif
593//*************************************************************************************************
594
595} // namespace blaze
596
597#endif
Header file for the basic SIMD types.
SIMD type for 64-bit double precision complex values.
SIMD type for 32-bit single precision complex values.
SIMD type for 64-bit double precision floating point data values.
SIMD type for 32-bit single precision floating point data values.
SIMD type for 16-bit unsigned integral data values.
SIMD type for 32-bit unsigned integral data values.
SIMD type for 64-bit unsigned integral data values.
SIMD type for 8-bit unsigned integral data values.
BLAZE_ALWAYS_INLINE const SIMDcdouble operator+(const SIMDcdouble &a, const SIMDcdouble &b) noexcept=delete
Addition of two vectors of double precision complex SIMD values.
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
System settings for the inline keywords.
System settings for the SSE mode.