All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Addition.h
Go to the documentation of this file.
1 //=================================================================================================
20 //=================================================================================================
21 
22 #ifndef _BLAZE_MATH_INTRINSICS_ADDITION_H_
23 #define _BLAZE_MATH_INTRINSICS_ADDITION_H_
24 
25 
26 //*************************************************************************************************
27 // Includes
28 //*************************************************************************************************
29 
31 #include <blaze/system/SSE.h>
32 
33 
34 namespace blaze {
35 
36 //=================================================================================================
37 //
38 // INTRINSIC ADDITION OPERATORS
39 //
40 //=================================================================================================
41 
42 //*************************************************************************************************
51 #if BLAZE_SSE2_MODE
52 inline sse_int8_t operator+( const sse_int8_t& a, const sse_int8_t& b )
53 {
54  return _mm_add_epi8( a.value, b.value );
55 }
56 #endif
57 //*************************************************************************************************
58 
59 
60 //*************************************************************************************************
69 #if BLAZE_SSE2_MODE
70 inline sse_int16_t operator+( const sse_int16_t& a, const sse_int16_t& b )
71 {
72  return _mm_add_epi16( a.value, b.value );
73 }
74 #endif
75 //*************************************************************************************************
76 
77 
78 //*************************************************************************************************
87 #if BLAZE_MIC_MODE
88 inline sse_int32_t operator+( const sse_int32_t& a, const sse_int32_t& b )
89 {
90  return _mm512_add_epi32( a.value, b.value );
91 }
92 #elif BLAZE_SSE2_MODE
93 inline sse_int32_t operator+( const sse_int32_t& a, const sse_int32_t& b )
94 {
95  return _mm_add_epi32( a.value, b.value );
96 }
97 #endif
98 //*************************************************************************************************
99 
100 
101 //*************************************************************************************************
110 #if BLAZE_MIC_MODE
111 inline sse_int64_t operator+( const sse_int64_t& a, const sse_int64_t& b )
112 {
113  return _mm512_add_epi64( a.value, b.value );
114 }
115 #elif BLAZE_SSE2_MODE
116 inline sse_int64_t operator+( const sse_int64_t& a, const sse_int64_t& b )
117 {
118  return _mm_add_epi64( a.value, b.value );
119 }
120 #endif
121 //*************************************************************************************************
122 
123 
124 //*************************************************************************************************
133 #if BLAZE_MIC_MODE
134 inline sse_float_t operator+( const sse_float_t& a, const sse_float_t& b )
135 {
136  return _mm512_add_ps( a.value, b.value );
137 }
138 #elif BLAZE_AVX_MODE
139 inline sse_float_t operator+( const sse_float_t& a, const sse_float_t& b )
140 {
141  return _mm256_add_ps( a.value, b.value );
142 }
143 #elif BLAZE_SSE_MODE
144 inline sse_float_t operator+( const sse_float_t& a, const sse_float_t& b )
145 {
146  return _mm_add_ps( a.value, b.value );
147 }
148 #endif
149 //*************************************************************************************************
150 
151 
152 //*************************************************************************************************
161 #if BLAZE_MIC_MODE
162 inline sse_double_t operator+( const sse_double_t& a, const sse_double_t& b )
163 {
164  return _mm512_add_pd( a.value, b.value );
165 }
166 #elif BLAZE_AVX_MODE
167 inline sse_double_t operator+( const sse_double_t& a, const sse_double_t& b )
168 {
169  return _mm256_add_pd( a.value, b.value );
170 }
171 #elif BLAZE_SSE2_MODE
172 inline sse_double_t operator+( const sse_double_t& a, const sse_double_t& b )
173 {
174  return _mm_add_pd( a.value, b.value );
175 }
176 #endif
177 //*************************************************************************************************
178 
179 } // namespace blaze
180 
181 #endif