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 
32 
33 
34 namespace blaze {
35 
36 //=================================================================================================
37 //
38 // INTRINSIC ADDITION OPERATORS
39 //
40 //=================================================================================================
41 
42 //*************************************************************************************************
51 #if BLAZE_AVX2_MODE
52 inline sse_int8_t operator+( const sse_int8_t& a, const sse_int8_t& b )
53 {
54  return _mm256_add_epi8( a.value, b.value );
55 }
56 #elif BLAZE_SSE2_MODE
57 inline sse_int8_t operator+( const sse_int8_t& a, const sse_int8_t& b )
58 {
59  return _mm_add_epi8( a.value, b.value );
60 }
61 #endif
62 //*************************************************************************************************
63 
64 
65 //*************************************************************************************************
74 #if BLAZE_AVX2_MODE
75 inline sse_int16_t operator+( const sse_int16_t& a, const sse_int16_t& b )
76 {
77  return _mm256_add_epi16( a.value, b.value );
78 }
79 #elif BLAZE_SSE2_MODE
80 inline sse_int16_t operator+( const sse_int16_t& a, const sse_int16_t& b )
81 {
82  return _mm_add_epi16( a.value, b.value );
83 }
84 #endif
85 //*************************************************************************************************
86 
87 
88 //*************************************************************************************************
97 #if BLAZE_MIC_MODE
98 inline sse_int32_t operator+( const sse_int32_t& a, const sse_int32_t& b )
99 {
100  return _mm512_add_epi32( a.value, b.value );
101 }
102 #elif BLAZE_AVX2_MODE
103 inline sse_int32_t operator+( const sse_int32_t& a, const sse_int32_t& b )
104 {
105  return _mm256_add_epi32( a.value, b.value );
106 }
107 #elif BLAZE_SSE2_MODE
108 inline sse_int32_t operator+( const sse_int32_t& a, const sse_int32_t& b )
109 {
110  return _mm_add_epi32( a.value, b.value );
111 }
112 #endif
113 //*************************************************************************************************
114 
115 
116 //*************************************************************************************************
125 #if BLAZE_MIC_MODE
126 inline sse_int64_t operator+( const sse_int64_t& a, const sse_int64_t& b )
127 {
128  return _mm512_add_epi64( a.value, b.value );
129 }
130 #elif BLAZE_AVX2_MODE
131 inline sse_int64_t operator+( const sse_int64_t& a, const sse_int64_t& b )
132 {
133  return _mm256_add_epi64( a.value, b.value );
134 }
135 #elif BLAZE_SSE2_MODE
136 inline sse_int64_t operator+( const sse_int64_t& a, const sse_int64_t& b )
137 {
138  return _mm_add_epi64( a.value, b.value );
139 }
140 #endif
141 //*************************************************************************************************
142 
143 
144 //*************************************************************************************************
153 #if BLAZE_MIC_MODE
154 inline sse_float_t operator+( const sse_float_t& a, const sse_float_t& b )
155 {
156  return _mm512_add_ps( a.value, b.value );
157 }
158 #elif BLAZE_AVX_MODE
159 inline sse_float_t operator+( const sse_float_t& a, const sse_float_t& b )
160 {
161  return _mm256_add_ps( a.value, b.value );
162 }
163 #elif BLAZE_SSE_MODE
164 inline sse_float_t operator+( const sse_float_t& a, const sse_float_t& b )
165 {
166  return _mm_add_ps( a.value, b.value );
167 }
168 #endif
169 //*************************************************************************************************
170 
171 
172 //*************************************************************************************************
181 #if BLAZE_MIC_MODE
182 inline sse_double_t operator+( const sse_double_t& a, const sse_double_t& b )
183 {
184  return _mm512_add_pd( a.value, b.value );
185 }
186 #elif BLAZE_AVX_MODE
187 inline sse_double_t operator+( const sse_double_t& a, const sse_double_t& b )
188 {
189  return _mm256_add_pd( a.value, b.value );
190 }
191 #elif BLAZE_SSE2_MODE
192 inline sse_double_t operator+( const sse_double_t& a, const sse_double_t& b )
193 {
194  return _mm_add_pd( a.value, b.value );
195 }
196 #endif
197 //*************************************************************************************************
198 
199 
200 //*************************************************************************************************
209 #if BLAZE_AVX_MODE
210 inline sse_cfloat_t operator+( const sse_cfloat_t& a, const sse_cfloat_t& b )
211 {
212  return _mm256_add_ps( a.value, b.value );
213 }
214 #elif BLAZE_SSE_MODE
215 inline sse_cfloat_t operator+( const sse_cfloat_t& a, const sse_cfloat_t& b )
216 {
217  return _mm_add_ps( a.value, b.value );
218 }
219 #endif
220 //*************************************************************************************************
221 
222 
223 //*************************************************************************************************
232 #if BLAZE_AVX_MODE
233 inline sse_cdouble_t operator+( const sse_cdouble_t& a, const sse_cdouble_t& b )
234 {
235  return _mm256_add_pd( a.value, b.value );
236 }
237 #elif BLAZE_SSE2_MODE
238 inline sse_cdouble_t operator+( const sse_cdouble_t& a, const sse_cdouble_t& b )
239 {
240  return _mm_add_pd( a.value, b.value );
241 }
242 #endif
243 //*************************************************************************************************
244 
245 } // namespace blaze
246 
247 #endif