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>
49 #include <blaze/util/mpl/And.h>
51 #include <blaze/util/Types.h>
54 
55 
56 namespace blaze {
57 
58 //=================================================================================================
59 //
60 // INTRINSIC STOREU FUNCTIONS
61 //
62 //=================================================================================================
63 
64 //*************************************************************************************************
75 template< typename T > // Type of the integral value
76 BLAZE_ALWAYS_INLINE typename EnableIf< And< IsIntegral<T>, HasSize<T,2UL> > >::Type
77  storeu( T* address, const sse_int16_t& value )
78 {
79 #if BLAZE_AVX2_MODE
80  _mm256_storeu_si256( reinterpret_cast<__m256i*>( address ), value.value );
81 #elif BLAZE_SSE2_MODE
82  _mm_storeu_si128( reinterpret_cast<__m128i*>( address ), value.value );
83 #else
84  *address = value.value;
85 #endif
86 }
87 //*************************************************************************************************
88 
89 
90 //*************************************************************************************************
101 template< typename T > // Type of the integral value
102 BLAZE_ALWAYS_INLINE typename EnableIf< And< IsIntegral<T>, HasSize<T,4UL> > >::Type
103  storeu( T* address, const sse_int32_t& value )
104 {
105 #if BLAZE_MIC_MODE
106  _mm512_packstorelo_epi32( address, value.value );
107  _mm512_packstorehi_epi32( address+16UL, value.value );
108 #elif BLAZE_AVX2_MODE
109  _mm256_storeu_si256( reinterpret_cast<__m256i*>( address ), value.value );
110 #elif BLAZE_SSE2_MODE
111  _mm_storeu_si128( reinterpret_cast<__m128i*>( address ), value.value );
112 #else
113  *address = value.value;
114 #endif
115 }
116 //*************************************************************************************************
117 
118 
119 //*************************************************************************************************
130 template< typename T > // Type of the integral value
131 BLAZE_ALWAYS_INLINE typename EnableIf< And< IsIntegral<T>, HasSize<T,8UL> > >::Type
132  storeu( T* address, const sse_int64_t& value )
133 {
134 #if BLAZE_MIC_MODE
135  _mm512_packstorelo_epi64( address, value.value );
136  _mm512_packstorehi_epi64( address+8UL, value.value );
137 #elif BLAZE_AVX2_MODE
138  _mm256_storeu_si256( reinterpret_cast<__m256i*>( address ), value.value );
139 #elif BLAZE_SSE2_MODE
140  _mm_storeu_si128( reinterpret_cast<__m128i*>( address ), value.value );
141 #else
142  *address = value.value;
143 #endif
144 }
145 //*************************************************************************************************
146 
147 
148 //*************************************************************************************************
159 BLAZE_ALWAYS_INLINE void storeu( float* address, const sse_float_t& value )
160 {
161 #if BLAZE_MIC_MODE
162  _mm512_packstorelo_ps( address , value.value );
163  _mm512_packstorehi_ps( address+16UL, value.value );
164 #elif BLAZE_AVX_MODE
165  _mm256_storeu_ps( address, value.value );
166 #elif BLAZE_SSE_MODE
167  _mm_storeu_ps( address, value.value );
168 #else
169  *address = value.value;
170 #endif
171 }
172 //*************************************************************************************************
173 
174 
175 //*************************************************************************************************
186 BLAZE_ALWAYS_INLINE void storeu( double* address, const sse_double_t& value )
187 {
188 #if BLAZE_MIC_MODE
189  _mm512_packstorelo_pd( address , value.value );
190  _mm512_packstorehi_pd( address+8UL, value.value );
191 #elif BLAZE_AVX_MODE
192  _mm256_storeu_pd( address, value.value );
193 #elif BLAZE_SSE2_MODE
194  _mm_storeu_pd( address, value.value );
195 #else
196  *address = value.value;
197 #endif
198 }
199 //*************************************************************************************************
200 
201 
202 //*************************************************************************************************
213 BLAZE_ALWAYS_INLINE void storeu( complex<float>* address, const sse_cfloat_t& value )
214 {
215  BLAZE_STATIC_ASSERT( sizeof( complex<float> ) == 2UL*sizeof( float ) );
216 
217 #if BLAZE_MIC_MODE
218  _mm512_packstorelo_ps( reinterpret_cast<float*>( address ), value.value );
219  _mm512_packstorehi_ps( reinterpret_cast<float*>( address+8UL ), value.value );
220 #elif BLAZE_AVX_MODE
221  _mm256_storeu_ps( reinterpret_cast<float*>( address ), value.value );
222 #elif BLAZE_SSE_MODE
223  _mm_storeu_ps( reinterpret_cast<float*>( address ), value.value );
224 #else
225  *address = value.value;
226 #endif
227 }
228 //*************************************************************************************************
229 
230 
231 //*************************************************************************************************
242 BLAZE_ALWAYS_INLINE void storeu( complex<double>* address, const sse_cdouble_t& value )
243 {
244  BLAZE_STATIC_ASSERT( sizeof( complex<double> ) == 2UL*sizeof( double ) );
245 
246 #if BLAZE_MIC_MODE
247  _mm512_packstorelo_pd( reinterpret_cast<double*>( address ), value.value );
248  _mm512_packstorehi_pd( reinterpret_cast<double*>( address+4UL ), value.value );
249 #elif BLAZE_AVX_MODE
250  _mm256_storeu_pd( reinterpret_cast<double*>( address ), value.value );
251 #elif BLAZE_SSE2_MODE
252  _mm_storeu_pd( reinterpret_cast<double*>( address ), value.value );
253 #else
254  *address = value.value;
255 #endif
256 }
257 //*************************************************************************************************
258 
259 } // namespace blaze
260 
261 #endif
Intrinsic type for 32-bit single precision complex values.
Header file for basic type definitions.
Header file for the IsIntegral type trait.
Header file for the And class template.
Intrinsic type for 64-bit integral 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.
Intrinsic type for 16-bit integral data values.
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 the HasSize type trait.
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > > >::Type storeu(T *address, const sse_int16_t &value)
Unaligned store of a vector of 2-byte integral values.
Definition: Storeu.h:77
System settings for the SSE mode.
Header file for the complex data type.
Intrinsic type for 32-bit integral data values.
#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.