Storeu.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_INTRINSICS_STOREU_H_
36 #define _BLAZE_MATH_INTRINSICS_STOREU_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
44 #include <blaze/system/Inline.h>
46 #include <blaze/util/Complex.h>
47 #include <blaze/util/EnableIf.h>
48 #include <blaze/util/mpl/And.h>
52 
53 
54 namespace blaze {
55 
56 //=================================================================================================
57 //
58 // INTRINSIC STOREU FUNCTIONS
59 //
60 //=================================================================================================
61 
62 //*************************************************************************************************
73 template< typename T > // Type of the integral value
74 BLAZE_ALWAYS_INLINE typename EnableIf< And< IsIntegral<T>, HasSize<T,2UL> > >::Type
75  storeu( T* address, const simd_int16_t& value )
76 {
77 #if BLAZE_AVX2_MODE
78  _mm256_storeu_si256( reinterpret_cast<__m256i*>( address ), value.value );
79 #elif BLAZE_SSE2_MODE
80  _mm_storeu_si128( reinterpret_cast<__m128i*>( address ), value.value );
81 #else
82  *address = value.value;
83 #endif
84 }
85 //*************************************************************************************************
86 
87 
88 //*************************************************************************************************
99 template< typename T > // Type of the integral value
100 BLAZE_ALWAYS_INLINE typename EnableIf< And< IsIntegral<T>, HasSize<T,4UL> > >::Type
101  storeu( T* address, const simd_int32_t& value )
102 {
103 #if BLAZE_MIC_MODE
104  _mm512_packstorelo_epi32( address, value.value );
105  _mm512_packstorehi_epi32( address+16UL, value.value );
106 #elif BLAZE_AVX2_MODE
107  _mm256_storeu_si256( reinterpret_cast<__m256i*>( address ), value.value );
108 #elif BLAZE_SSE2_MODE
109  _mm_storeu_si128( reinterpret_cast<__m128i*>( address ), value.value );
110 #else
111  *address = value.value;
112 #endif
113 }
114 //*************************************************************************************************
115 
116 
117 //*************************************************************************************************
128 template< typename T > // Type of the integral value
129 BLAZE_ALWAYS_INLINE typename EnableIf< And< IsIntegral<T>, HasSize<T,8UL> > >::Type
130  storeu( T* address, const simd_int64_t& value )
131 {
132 #if BLAZE_MIC_MODE
133  _mm512_packstorelo_epi64( address, value.value );
134  _mm512_packstorehi_epi64( address+8UL, value.value );
135 #elif BLAZE_AVX2_MODE
136  _mm256_storeu_si256( reinterpret_cast<__m256i*>( address ), value.value );
137 #elif BLAZE_SSE2_MODE
138  _mm_storeu_si128( reinterpret_cast<__m128i*>( address ), value.value );
139 #else
140  *address = value.value;
141 #endif
142 }
143 //*************************************************************************************************
144 
145 
146 //*************************************************************************************************
157 BLAZE_ALWAYS_INLINE void storeu( float* address, const simd_float_t& value )
158 {
159 #if BLAZE_MIC_MODE
160  _mm512_packstorelo_ps( address , value.value );
161  _mm512_packstorehi_ps( address+16UL, value.value );
162 #elif BLAZE_AVX_MODE
163  _mm256_storeu_ps( address, value.value );
164 #elif BLAZE_SSE_MODE
165  _mm_storeu_ps( address, value.value );
166 #else
167  *address = value.value;
168 #endif
169 }
170 //*************************************************************************************************
171 
172 
173 //*************************************************************************************************
184 BLAZE_ALWAYS_INLINE void storeu( double* address, const simd_double_t& value )
185 {
186 #if BLAZE_MIC_MODE
187  _mm512_packstorelo_pd( address , value.value );
188  _mm512_packstorehi_pd( address+8UL, value.value );
189 #elif BLAZE_AVX_MODE
190  _mm256_storeu_pd( address, value.value );
191 #elif BLAZE_SSE2_MODE
192  _mm_storeu_pd( address, value.value );
193 #else
194  *address = value.value;
195 #endif
196 }
197 //*************************************************************************************************
198 
199 
200 //*************************************************************************************************
211 template< typename T > // Type of the integral value
212 BLAZE_ALWAYS_INLINE typename EnableIf< And< IsIntegral<T>, HasSize<T,2UL> > >::Type
213  storeu( complex<T>* address, const simd_cint16_t& value )
214 {
215  BLAZE_STATIC_ASSERT( sizeof( complex<T> ) == 2UL*sizeof( T ) );
216 
217 #if BLAZE_AVX2_MODE
218  _mm256_storeu_si256( reinterpret_cast<__m256i*>( address ), value.value );
219 #elif BLAZE_SSE2_MODE
220  _mm_storeu_si128( reinterpret_cast<__m128i*>( address ), value.value );
221 #else
222  *address = value.value;
223 #endif
224 }
225 //*************************************************************************************************
226 
227 
228 //*************************************************************************************************
239 template< typename T > // Type of the integral value
240 BLAZE_ALWAYS_INLINE typename EnableIf< And< IsIntegral<T>, HasSize<T,4UL> > >::Type
241  storeu( complex<T>* address, const simd_cint32_t& value )
242 {
243  BLAZE_STATIC_ASSERT( sizeof( complex<T> ) == 2UL*sizeof( T ) );
244 
245 #if BLAZE_MIC_MODE
246  _mm512_packstorelo_epi32( address, value.value );
247  _mm512_packstorehi_epi32( address+16UL, value.value );
248 #elif BLAZE_AVX2_MODE
249  _mm256_storeu_si256( reinterpret_cast<__m256i*>( address ), value.value );
250 #elif BLAZE_SSE2_MODE
251  _mm_storeu_si128( reinterpret_cast<__m128i*>( address ), value.value );
252 #else
253  *address = value.value;
254 #endif
255 }
256 //*************************************************************************************************
257 
258 
259 //*************************************************************************************************
270 template< typename T > // Type of the integral value
271 BLAZE_ALWAYS_INLINE typename EnableIf< And< IsIntegral<T>, HasSize<T,8UL> > >::Type
272  storeu( complex<T>* address, const simd_cint64_t& value )
273 {
274  BLAZE_STATIC_ASSERT( sizeof( complex<T> ) == 2UL*sizeof( T ) );
275 
276 #if BLAZE_MIC_MODE
277  _mm512_packstorelo_epi64( address, value.value );
278  _mm512_packstorehi_epi64( address+8UL, value.value );
279 #elif BLAZE_AVX2_MODE
280  _mm256_storeu_si256( reinterpret_cast<__m256i*>( address ), value.value );
281 #elif BLAZE_SSE2_MODE
282  _mm_storeu_si128( reinterpret_cast<__m128i*>( address ), value.value );
283 #else
284  *address = value.value;
285 #endif
286 }
287 //*************************************************************************************************
288 
289 
290 //*************************************************************************************************
301 BLAZE_ALWAYS_INLINE void storeu( complex<float>* address, const simd_cfloat_t& value )
302 {
303  BLAZE_STATIC_ASSERT( sizeof( complex<float> ) == 2UL*sizeof( float ) );
304 
305 #if BLAZE_MIC_MODE
306  _mm512_packstorelo_ps( reinterpret_cast<float*>( address ), value.value );
307  _mm512_packstorehi_ps( reinterpret_cast<float*>( address+8UL ), value.value );
308 #elif BLAZE_AVX_MODE
309  _mm256_storeu_ps( reinterpret_cast<float*>( address ), value.value );
310 #elif BLAZE_SSE_MODE
311  _mm_storeu_ps( reinterpret_cast<float*>( address ), value.value );
312 #else
313  *address = value.value;
314 #endif
315 }
316 //*************************************************************************************************
317 
318 
319 //*************************************************************************************************
330 BLAZE_ALWAYS_INLINE void storeu( complex<double>* address, const simd_cdouble_t& value )
331 {
332  BLAZE_STATIC_ASSERT( sizeof( complex<double> ) == 2UL*sizeof( double ) );
333 
334 #if BLAZE_MIC_MODE
335  _mm512_packstorelo_pd( reinterpret_cast<double*>( address ), value.value );
336  _mm512_packstorehi_pd( reinterpret_cast<double*>( address+4UL ), value.value );
337 #elif BLAZE_AVX_MODE
338  _mm256_storeu_pd( reinterpret_cast<double*>( address ), value.value );
339 #elif BLAZE_SSE2_MODE
340  _mm_storeu_pd( reinterpret_cast<double*>( address ), value.value );
341 #else
342  *address = value.value;
343 #endif
344 }
345 //*************************************************************************************************
346 
347 } // namespace blaze
348 
349 #endif
Intrinsic type for 16-bit integral data values.
Header file for the IsIntegral type trait.
Header file for the And class template.
Intrinsic type for 64-bit double precision floating point data values.
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
Compile time assertion.
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > > >::Type storeu(T *address, const simd_int16_t &value)
Unaligned store of a vector of 2-byte integral values.
Definition: Storeu.h:75
Header file for the EnableIf class template.
Header file for the basic intrinsic types.
Intrinsic type for 64-bit integral complex values.
Intrinsic type for 32-bit single precision floating point data values.
Header file for the HasSize type trait.
Intrinsic type for 64-bit integral data values.
Intrinsic type for 32-bit integral complex values.
Intrinsic type for 64-bit double precision complex values.
Intrinsic type for 32-bit single precision complex values.
Intrinsic type for 16-bit integral complex values.
System settings for the SSE mode.
Header file for the complex data type.
#define BLAZE_STATIC_ASSERT(expr)
Compile time assertion macro.In case of an invalid compile time expression, a compilation error is cr...
Definition: StaticAssert.h:143
System settings for the inline keywords.
Intrinsic type for 32-bit integral data values.