All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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>
48 #include <blaze/util/EnableIf.h>
50 #include <blaze/util/Types.h>
51 
52 
53 namespace blaze {
54 
55 //=================================================================================================
56 //
57 // CLASS DEFINITION
58 //
59 //=================================================================================================
60 
61 //*************************************************************************************************
71 template< typename T // Type of the integral
72  , size_t N > // Size of the integral
73 struct Storeu;
75 //*************************************************************************************************
76 
77 
78 
79 
80 //=================================================================================================
81 //
82 // SPECIALIZATIONS OF THE STOREU CLASS TEMPLATE
83 //
84 //=================================================================================================
85 
86 //*************************************************************************************************
91 template< typename T > // Type of the integral
92 struct Storeu<T,2UL>
93 {
94  public:
95  //**Type definitions****************************************************************************
96  typedef sse_int16_t Type;
97  //**********************************************************************************************
98 
99  //**Set function********************************************************************************
100  static BLAZE_ALWAYS_INLINE void storeu( T* address, const Type& value )
101  {
102 #if BLAZE_AVX2_MODE
103  _mm256_storeu_si256( reinterpret_cast<__m256i*>( address ), value.value );
104 #elif BLAZE_SSE2_MODE
105  _mm_storeu_si128( reinterpret_cast<__m128i*>( address ), value.value );
106 #else
107  *address = value.value;
108 #endif
109  }
110  //**********************************************************************************************
111 
112  private:
113  //**Compile time checks*************************************************************************
115  //**********************************************************************************************
116 };
118 //*************************************************************************************************
119 
120 
121 //*************************************************************************************************
126 template< typename T > // Type of the integral
127 struct Storeu<T,4UL>
128 {
129  public:
130  //**Type definitions****************************************************************************
131  typedef sse_int32_t Type;
132  //**********************************************************************************************
133 
134  //**Set function********************************************************************************
135  static BLAZE_ALWAYS_INLINE void storeu( T* address, const Type& value )
136  {
137 #if BLAZE_MIC_MODE
138  _mm512_packstorelo_epi32( address, value.value );
139  _mm512_packstorehi_epi32( address+16UL, value.value );
140 #elif BLAZE_AVX2_MODE
141  _mm256_storeu_si256( reinterpret_cast<__m256i*>( address ), value.value );
142 #elif BLAZE_SSE2_MODE
143  _mm_storeu_si128( reinterpret_cast<__m128i*>( address ), value.value );
144 #else
145  *address = value.value;
146 #endif
147  }
148  //**********************************************************************************************
149 
150  private:
151  //**Compile time checks*************************************************************************
153  //**********************************************************************************************
154 };
156 //*************************************************************************************************
157 
158 
159 //*************************************************************************************************
164 template< typename T > // Type of the integral
165 struct Storeu<T,8UL>
166 {
167  public:
168  //**Type definitions****************************************************************************
169  typedef sse_int64_t Type;
170  //**********************************************************************************************
171 
172  //**Set function********************************************************************************
173  static BLAZE_ALWAYS_INLINE void storeu( T* address, const Type& value )
174  {
175 #if BLAZE_MIC_MODE
176  _mm512_packstorelo_epi64( address, value.value );
177  _mm512_packstorehi_epi64( address+8UL, value.value );
178 #elif BLAZE_AVX2_MODE
179  _mm256_storeu_si256( reinterpret_cast<__m256i*>( address ), value.value );
180 #elif BLAZE_SSE2_MODE
181  _mm_storeu_si128( reinterpret_cast<__m128i*>( address ), value.value );
182 #else
183  *address = value.value;
184 #endif
185  }
186  //**********************************************************************************************
187 
188  private:
189  //**Compile time checks*************************************************************************
191  //**********************************************************************************************
192 };
194 //*************************************************************************************************
195 
196 
197 
198 
199 //=================================================================================================
200 //
201 // INTRINSIC STOREU FUNCTIONS
202 //
203 //=================================================================================================
204 
205 //*************************************************************************************************
216 template< typename T > // Type of the integral value
217 BLAZE_ALWAYS_INLINE typename EnableIf< IsIntegral<T> >::Type
218  storeu( T* address, const typename Storeu<T,sizeof(T)>::Type& value )
219 {
220  Storeu<T,sizeof(T)>::storeu( address, value );
221 }
222 //*************************************************************************************************
223 
224 
225 //*************************************************************************************************
236 BLAZE_ALWAYS_INLINE void storeu( float* address, const sse_float_t& value )
237 {
238 #if BLAZE_MIC_MODE
239  _mm512_packstorelo_ps( address , value.value );
240  _mm512_packstorehi_ps( address+16UL, value.value );
241 #elif BLAZE_AVX_MODE
242  _mm256_storeu_ps( address, value.value );
243 #elif BLAZE_SSE_MODE
244  _mm_storeu_ps( address, value.value );
245 #else
246  *address = value.value;
247 #endif
248 }
249 //*************************************************************************************************
250 
251 
252 //*************************************************************************************************
263 BLAZE_ALWAYS_INLINE void storeu( double* address, const sse_double_t& value )
264 {
265 #if BLAZE_MIC_MODE
266  _mm512_packstorelo_pd( address , value.value );
267  _mm512_packstorehi_pd( address+8UL, value.value );
268 #elif BLAZE_AVX_MODE
269  _mm256_storeu_pd( address, value.value );
270 #elif BLAZE_SSE2_MODE
271  _mm_storeu_pd( address, value.value );
272 #else
273  *address = value.value;
274 #endif
275 }
276 //*************************************************************************************************
277 
278 
279 //*************************************************************************************************
290 BLAZE_ALWAYS_INLINE void storeu( complex<float>* address, const sse_cfloat_t& value )
291 {
292  BLAZE_STATIC_ASSERT( sizeof( complex<float> ) == 2UL*sizeof( float ) );
293 
294 #if BLAZE_MIC_MODE
295  _mm512_packstorelo_ps( reinterpret_cast<float*>( address ), value.value );
296  _mm512_packstorehi_ps( reinterpret_cast<float*>( address+8UL ), value.value );
297 #elif BLAZE_AVX_MODE
298  _mm256_storeu_ps( reinterpret_cast<float*>( address ), value.value );
299 #elif BLAZE_SSE_MODE
300  _mm_storeu_ps( reinterpret_cast<float*>( address ), value.value );
301 #else
302  *address = value.value;
303 #endif
304 }
305 //*************************************************************************************************
306 
307 
308 //*************************************************************************************************
319 BLAZE_ALWAYS_INLINE void storeu( complex<double>* address, const sse_cdouble_t& value )
320 {
321  BLAZE_STATIC_ASSERT( sizeof( complex<double> ) == 2UL*sizeof( double ) );
322 
323 #if BLAZE_MIC_MODE
324  _mm512_packstorelo_pd( reinterpret_cast<double*>( address ), value.value );
325  _mm512_packstorehi_pd( reinterpret_cast<double*>( address+4UL ), value.value );
326 #elif BLAZE_AVX_MODE
327  _mm256_storeu_pd( reinterpret_cast<double*>( address ), value.value );
328 #elif BLAZE_SSE2_MODE
329  _mm_storeu_pd( reinterpret_cast<double*>( address ), value.value );
330 #else
331  *address = value.value;
332 #endif
333 }
334 //*************************************************************************************************
335 
336 } // namespace blaze
337 
338 #endif
Intrinsic type for 32-bit single precision complex values.
BLAZE_ALWAYS_INLINE void storeu(complex< double > *address, const sse_cdouble_t &value)
Unaligned store of a vector of 'complex' values.
Definition: Storeu.h:319
#define BLAZE_CONSTRAINT_MUST_BE_INTEGRAL_TYPE(T)
Constraint on the data type.In case the given data type T is not an integral data type...
Definition: Integral.h:78
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
Compile time assertion.
Intrinsic type for 32-bit single precision floating point data values.
Intrinsic type for 64-bit double precision complex values.
Constraint on the data type.
Header file for the EnableIf class template.
Intrinsic type for 64-bit double precision floating point data values.
Header file for the basic intrinsic types.
Header file for basic type definitions.
BLAZE_ALWAYS_INLINE EnableIf< IsIntegral< T > >::Type storeu(T *address, const typename Storeu< T, sizeof(T)>::Type &value)
Unaligned store of a vector of integral values.
Definition: Storeu.h:218
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.