BasicTypes.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_SIMD_BASICTYPES_H_
36 #define _BLAZE_MATH_SIMD_BASICTYPES_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
44 #include <blaze/system/Inline.h>
46 #include <blaze/util/Complex.h>
47 #include <blaze/util/TrueType.h>
48 #include <blaze/util/Types.h>
49 
50 
51 namespace blaze {
52 
53 //=================================================================================================
54 //
55 // 8-BIT INTEGRAL SIMD TYPES
56 //
57 //=================================================================================================
58 
59 //*************************************************************************************************
60 /*\class blaze::SIMDi8
61 // \brief Base class for all 8-bit integral SIMD data types.
62 // \ingroup simd
63 */
65 template< typename T > // Type of the SIMD element
66 struct SIMDi8 : public SIMDPack< T >
67 {};
69 //*************************************************************************************************
70 
71 
72 //*************************************************************************************************
78 struct SIMDint8 : public SIMDi8< SIMDint8 >
79 {
80  using This = SIMDint8;
81  using BaseType = SIMDi8<This>;
82  using ValueType = int8_t;
83 
84 #if BLAZE_MIC_MODE
85  using IntrinsicType = ValueType;
86  BLAZE_ALWAYS_INLINE SIMDint8() noexcept : value( 0 ) {}
87  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
88  enum : size_t { size = 1UL };
89 #elif BLAZE_AVX2_MODE
90  using IntrinsicType = __m256i;
91  BLAZE_ALWAYS_INLINE SIMDint8() noexcept : value( _mm256_setzero_si256() ) {}
92  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
93  enum : size_t { size = 32UL };
94 #elif BLAZE_SSE2_MODE
95  using IntrinsicType = __m128i;
96  BLAZE_ALWAYS_INLINE SIMDint8() noexcept : value( _mm_setzero_si128() ) {}
97  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
98  enum : size_t { size = 16UL };
99 #else
100  using IntrinsicType = ValueType;
101  BLAZE_ALWAYS_INLINE SIMDint8() noexcept : value( 0 ) {}
102  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
103  enum : size_t { size = 1UL };
104 #endif
105 
106  BLAZE_ALWAYS_INLINE SIMDint8( IntrinsicType v ) noexcept : value( v ) {}
107 
108  template< typename T >
109  BLAZE_ALWAYS_INLINE SIMDint8( const SIMDi8<T>& v ) noexcept : value( (~v).value ) {}
110 
111  template< typename T >
112  BLAZE_ALWAYS_INLINE SIMDint8& operator=( const SIMDi8<T>& v ) noexcept { value = (~v).value; return *this; }
113 
114  IntrinsicType value;
115 };
117 //*************************************************************************************************
118 
119 
120 //*************************************************************************************************
126 struct SIMDuint8 : public SIMDi8< SIMDuint8 >
127 {
128  using This = SIMDuint8;
129  using BaseType = SIMDi8<This>;
130  using ValueType = uint8_t;
131 
132 #if BLAZE_MIC_MODE
133  using IntrinsicType = ValueType;
134  BLAZE_ALWAYS_INLINE SIMDuint8() noexcept : value( 0 ) {}
135  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
136  enum : size_t { size = 1UL };
137 #elif BLAZE_AVX2_MODE
138  using IntrinsicType = __m256i;
139  BLAZE_ALWAYS_INLINE SIMDuint8() noexcept : value( _mm256_setzero_si256() ) {}
140  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
141  enum : size_t { size = 32UL };
142 #elif BLAZE_SSE2_MODE
143  using IntrinsicType = __m128i;
144  BLAZE_ALWAYS_INLINE SIMDuint8() noexcept : value( _mm_setzero_si128() ) {}
145  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
146  enum : size_t { size = 16UL };
147 #else
148  using IntrinsicType = ValueType;
149  BLAZE_ALWAYS_INLINE SIMDuint8() noexcept : value( 0 ) {}
150  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
151  enum : size_t { size = 1UL };
152 #endif
153 
154  BLAZE_ALWAYS_INLINE SIMDuint8( IntrinsicType v ) noexcept : value( v ) {}
155 
156  template< typename T >
157  BLAZE_ALWAYS_INLINE SIMDuint8( const SIMDi8<T>& v ) noexcept : value( (~v).value ) {}
158 
159  template< typename T >
160  BLAZE_ALWAYS_INLINE SIMDuint8& operator=( const SIMDi8<T>& v ) noexcept { value = (~v).value; return *this; }
161 
162  IntrinsicType value;
163 };
165 //*************************************************************************************************
166 
167 
168 
169 
170 //=================================================================================================
171 //
172 // 8-BIT INTEGRAL COMPLEX SIMD TYPES
173 //
174 //=================================================================================================
175 
176 //*************************************************************************************************
177 /*\class blaze::SIMDci8
178 // \brief Base class for all 8-bit integral complex SIMD data types.
179 // \ingroup simd
180 */
182 template< typename T > // Type of the SIMD element
183 struct SIMDci8 : public SIMDPack< T >
184 {};
186 //*************************************************************************************************
187 
188 
189 //*************************************************************************************************
195 struct SIMDcint8 : public SIMDci8< SIMDcint8 >
196 {
197  using This = SIMDcint8;
198  using BaseType = SIMDci8<This>;
199  using ValueType = complex<int8_t>;
200 
201 #if BLAZE_MIC_MODE
202  using IntrinsicType = ValueType;
203  BLAZE_ALWAYS_INLINE SIMDcint8() noexcept : value( 0, 0 ) {}
204  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
205  enum : size_t { size = 1UL };
206 #elif BLAZE_AVX2_MODE
207  using IntrinsicType = __m256i;
208  BLAZE_ALWAYS_INLINE SIMDcint8() noexcept : value( _mm256_setzero_si256() ) {}
209  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
210  enum : size_t { size = 16UL };
211 #elif BLAZE_SSE2_MODE
212  using IntrinsicType = __m128i;
213  BLAZE_ALWAYS_INLINE SIMDcint8() noexcept : value( _mm_setzero_si128() ) {}
214  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
215  enum : size_t { size = 8UL };
216 #else
217  using IntrinsicType = ValueType;
218  BLAZE_ALWAYS_INLINE SIMDcint8() noexcept : value( 0, 0 ) {}
219  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
220  enum : size_t { size = 1UL };
221 #endif
222 
223  BLAZE_ALWAYS_INLINE SIMDcint8( IntrinsicType v ) noexcept : value( v ) {}
224 
225  template< typename T >
226  BLAZE_ALWAYS_INLINE SIMDcint8( const SIMDci8<T>& v ) noexcept : value( (~v).value ) {}
227 
228  template< typename T >
229  BLAZE_ALWAYS_INLINE SIMDcint8& operator=( const SIMDci8<T>& v ) noexcept { value = (~v).value; return *this; }
230 
231  IntrinsicType value;
232 };
234 //*************************************************************************************************
235 
236 
237 //*************************************************************************************************
243 struct SIMDcuint8 : public SIMDci8< SIMDcuint8 >
244 {
245  using This = SIMDcuint8;
246  using BaseType = SIMDci8<This>;
247  using ValueType = complex<uint8_t>;
248 
249 #if BLAZE_MIC_MODE
250  using IntrinsicType = ValueType;
251  BLAZE_ALWAYS_INLINE SIMDcuint8() noexcept : value( 0, 0 ) {}
252  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
253  enum : size_t { size = 1UL };
254 #elif BLAZE_AVX2_MODE
255  using IntrinsicType = __m256i;
256  BLAZE_ALWAYS_INLINE SIMDcuint8() noexcept : value( _mm256_setzero_si256() ) {}
257  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
258  enum : size_t { size = 16UL };
259 #elif BLAZE_SSE2_MODE
260  using IntrinsicType = __m128i;
261  BLAZE_ALWAYS_INLINE SIMDcuint8() noexcept : value( _mm_setzero_si128() ) {}
262  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
263  enum : size_t { size = 8UL };
264 #else
265  using IntrinsicType = ValueType;
266  BLAZE_ALWAYS_INLINE SIMDcuint8() noexcept : value( 0, 0 ) {}
267  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
268  enum : size_t { size = 1UL };
269 #endif
270 
271  BLAZE_ALWAYS_INLINE SIMDcuint8( IntrinsicType v ) noexcept : value( v ) {}
272 
273  template< typename T >
274  BLAZE_ALWAYS_INLINE SIMDcuint8( const SIMDci8<T>& v ) noexcept : value( (~v).value ) {}
275 
276  template< typename T >
277  BLAZE_ALWAYS_INLINE SIMDcuint8& operator=( const SIMDci8<T>& v ) noexcept { value = (~v).value; return *this; }
278 
279  IntrinsicType value;
280 };
282 //*************************************************************************************************
283 
284 
285 
286 
287 //=================================================================================================
288 //
289 // 16-BIT INTEGRAL SIMD TYPES
290 //
291 //=================================================================================================
292 
293 //*************************************************************************************************
294 /*\class blaze::SIMDi16
295 // \brief Base class for all 16-bit integral SIMD data types.
296 // \ingroup simd
297 */
299 template< typename T > // Type of the SIMD element
300 struct SIMDi16 : public SIMDPack< T >
301 {};
303 //*************************************************************************************************
304 
305 
306 //*************************************************************************************************
312 struct SIMDint16 : public SIMDi16< SIMDint16 >
313 {
314  using This = SIMDint16;
315  using BaseType = SIMDi16<This>;
316  using ValueType = int16_t;
317 
318 #if BLAZE_MIC_MODE
319  using IntrinsicType = ValueType;
320  BLAZE_ALWAYS_INLINE SIMDint16() noexcept : value( 0 ) {}
321  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
322  enum : size_t { size = 1UL };
323 #elif BLAZE_AVX2_MODE
324  using IntrinsicType = __m256i;
325  BLAZE_ALWAYS_INLINE SIMDint16() noexcept : value( _mm256_setzero_si256() ) {}
326  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
327  enum : size_t { size = 16UL };
328 #elif BLAZE_SSE2_MODE
329  using IntrinsicType = __m128i;
330  BLAZE_ALWAYS_INLINE SIMDint16() noexcept : value( _mm_setzero_si128() ) {}
331  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
332  enum : size_t { size = 8UL };
333 #else
334  using IntrinsicType = ValueType;
335  BLAZE_ALWAYS_INLINE SIMDint16() noexcept : value( 0 ) {}
336  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
337  enum : size_t { size = 1UL };
338 #endif
339 
340  BLAZE_ALWAYS_INLINE SIMDint16( IntrinsicType v ) noexcept : value( v ) {}
341 
342  template< typename T >
343  BLAZE_ALWAYS_INLINE SIMDint16( const SIMDi16<T>& v ) noexcept : value( (~v).value ) {}
344 
345  template< typename T >
346  BLAZE_ALWAYS_INLINE SIMDint16& operator=( const SIMDi16<T>& v ) noexcept { value = (~v).value; return *this; }
347 
348  IntrinsicType value;
349 };
351 //*************************************************************************************************
352 
353 
354 //*************************************************************************************************
360 struct SIMDuint16 : public SIMDi16< SIMDuint16 >
361 {
362  using This = SIMDuint16;
363  using BaseType = SIMDi16<This>;
364  using ValueType = uint16_t;
365 
366 #if BLAZE_MIC_MODE
367  using IntrinsicType = ValueType;
368  BLAZE_ALWAYS_INLINE SIMDuint16() noexcept : value( 0 ) {}
369  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
370  enum : size_t { size = 1UL };
371 #elif BLAZE_AVX2_MODE
372  using IntrinsicType = __m256i;
373  BLAZE_ALWAYS_INLINE SIMDuint16() noexcept : value( _mm256_setzero_si256() ) {}
374  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
375  enum : size_t { size = 16UL };
376 #elif BLAZE_SSE2_MODE
377  using IntrinsicType = __m128i;
378  BLAZE_ALWAYS_INLINE SIMDuint16() noexcept : value( _mm_setzero_si128() ) {}
379  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
380  enum : size_t { size = 8UL };
381 #else
382  using IntrinsicType = ValueType;
383  BLAZE_ALWAYS_INLINE SIMDuint16() noexcept : value( 0 ) {}
384  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
385  enum : size_t { size = 1UL };
386 #endif
387 
388  BLAZE_ALWAYS_INLINE SIMDuint16( IntrinsicType v ) noexcept : value( v ) {}
389 
390  template< typename T >
391  BLAZE_ALWAYS_INLINE SIMDuint16( const SIMDi16<T>& v ) noexcept : value( (~v).value ) {}
392 
393  template< typename T >
394  BLAZE_ALWAYS_INLINE SIMDuint16& operator=( const SIMDi16<T>& v ) noexcept { value = (~v).value; return *this; }
395 
396  IntrinsicType value;
397 };
399 //*************************************************************************************************
400 
401 
402 
403 
404 //=================================================================================================
405 //
406 // 16-BIT INTEGRAL COMPLEX SIMD TYPES
407 //
408 //=================================================================================================
409 
410 //*************************************************************************************************
411 /*\class blaze::SIMDci16
412 // \brief Base class for all 16-bit integral complex SIMD data types.
413 // \ingroup simd
414 */
416 template< typename T > // Type of the SIMD element
417 struct SIMDci16 : public SIMDPack< T >
418 {};
420 //*************************************************************************************************
421 
422 
423 //*************************************************************************************************
429 struct SIMDcint16 : public SIMDci16< SIMDcint16 >
430 {
431  using This = SIMDcint16;
432  using BaseType = SIMDci16<This>;
433  using ValueType = complex<int16_t>;
434 
435 #if BLAZE_MIC_MODE
436  using IntrinsicType = ValueType;
437  BLAZE_ALWAYS_INLINE SIMDcint16() noexcept : value( 0, 0 ) {}
438  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
439  enum : size_t { size = 1UL };
440 #elif BLAZE_AVX2_MODE
441  using IntrinsicType = __m256i;
442  BLAZE_ALWAYS_INLINE SIMDcint16() noexcept : value( _mm256_setzero_si256() ) {}
443  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
444  enum : size_t { size = 8UL };
445 #elif BLAZE_SSE2_MODE
446  using IntrinsicType = __m128i;
447  BLAZE_ALWAYS_INLINE SIMDcint16() noexcept : value( _mm_setzero_si128() ) {}
448  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
449  enum : size_t { size = 4UL };
450 #else
451  using IntrinsicType = ValueType;
452  BLAZE_ALWAYS_INLINE SIMDcint16() noexcept : value( 0, 0 ) {}
453  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
454  enum : size_t { size = 1UL };
455 #endif
456 
457  BLAZE_ALWAYS_INLINE SIMDcint16( IntrinsicType v ) noexcept : value( v ) {}
458 
459  template< typename T >
460  BLAZE_ALWAYS_INLINE SIMDcint16( const SIMDci16<T>& v ) noexcept : value( (~v).value ) {}
461 
462  template< typename T >
463  BLAZE_ALWAYS_INLINE SIMDcint16& operator=( const SIMDci16<T>& v ) noexcept { value = (~v).value; return *this; }
464 
465  IntrinsicType value;
466 };
468 //*************************************************************************************************
469 
470 
471 //*************************************************************************************************
477 struct SIMDcuint16 : public SIMDci16< SIMDcuint16 >
478 {
479  using This = SIMDcuint16;
480  using BaseType = SIMDci16<This>;
481  using ValueType = complex<uint16_t>;
482 
483 #if BLAZE_MIC_MODE
484  using IntrinsicType = ValueType;
485  BLAZE_ALWAYS_INLINE SIMDcuint16() noexcept : value( 0, 0 ) {}
486  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
487  enum : size_t { size = 1UL };
488 #elif BLAZE_AVX2_MODE
489  using IntrinsicType = __m256i;
490  BLAZE_ALWAYS_INLINE SIMDcuint16() noexcept : value( _mm256_setzero_si256() ) {}
491  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
492  enum : size_t { size = 8UL };
493 #elif BLAZE_SSE2_MODE
494  using IntrinsicType = __m128i;
495  BLAZE_ALWAYS_INLINE SIMDcuint16() noexcept : value( _mm_setzero_si128() ) {}
496  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
497  enum : size_t { size = 4UL };
498 #else
499  using IntrinsicType = ValueType;
500  BLAZE_ALWAYS_INLINE SIMDcuint16() noexcept : value( 0, 0 ) {}
501  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
502  enum : size_t { size = 1UL };
503 #endif
504 
505  BLAZE_ALWAYS_INLINE SIMDcuint16( IntrinsicType v ) noexcept : value( v ) {}
506 
507  template< typename T >
508  BLAZE_ALWAYS_INLINE SIMDcuint16( const SIMDci16<T>& v ) noexcept : value( (~v).value ) {}
509 
510  template< typename T >
511  BLAZE_ALWAYS_INLINE SIMDcuint16& operator=( const SIMDci16<T>& v ) noexcept { value = (~v).value; return *this; }
512 
513  IntrinsicType value;
514 };
516 //*************************************************************************************************
517 
518 
519 
520 
521 //=================================================================================================
522 //
523 // 32-BIT INTEGRAL SIMD TYPES
524 //
525 //=================================================================================================
526 
527 //*************************************************************************************************
528 /*\class blaze::SIMDi32
529 // \brief Base class for all 32-bit integral SIMD data types.
530 // \ingroup simd
531 */
533 template< typename T > // Type of the SIMD element
534 struct SIMDi32 : public SIMDPack< T >
535 {};
537 //*************************************************************************************************
538 
539 
540 //*************************************************************************************************
546 struct SIMDint32 : public SIMDi32< SIMDint32 >
547 {
548  using This = SIMDint32;
549  using BaseType = SIMDi32<This>;
550  using ValueType = int32_t;
551 
552 #if BLAZE_MIC_MODE
553  using IntrinsicType = __m512i;
554  BLAZE_ALWAYS_INLINE SIMDint32() noexcept : value( _mm512_setzero_epi32() ) {}
555  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
556  enum : size_t { size = 16UL };
557 #elif BLAZE_AVX2_MODE
558  using IntrinsicType = __m256i;
559  BLAZE_ALWAYS_INLINE SIMDint32() noexcept : value( _mm256_setzero_si256() ) {}
560  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
561  enum : size_t { size = 8UL };
562 #elif BLAZE_SSE2_MODE
563  using IntrinsicType = __m128i;
564  BLAZE_ALWAYS_INLINE SIMDint32() noexcept : value( _mm_setzero_si128() ) {}
565  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
566  enum : size_t { size = 4UL };
567 #else
568  using IntrinsicType = ValueType;
569  BLAZE_ALWAYS_INLINE SIMDint32() noexcept : value( 0 ) {}
570  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
571  enum : size_t { size = 1UL };
572 #endif
573 
574  BLAZE_ALWAYS_INLINE SIMDint32( IntrinsicType v ) noexcept : value( v ) {}
575 
576  template< typename T >
577  BLAZE_ALWAYS_INLINE SIMDint32( const SIMDi32<T>& v ) noexcept : value( (~v).value ) {}
578 
579  template< typename T >
580  BLAZE_ALWAYS_INLINE SIMDint32& operator=( const SIMDi32<T>& v ) noexcept { value = (~v).value; return *this; }
581 
582  IntrinsicType value;
583 };
585 //*************************************************************************************************
586 
587 
588 //*************************************************************************************************
594 struct SIMDuint32 : public SIMDi32< SIMDuint32 >
595 {
596  using This = SIMDuint32;
597  using BaseType = SIMDi32<This>;
598  using ValueType = uint32_t;
599 
600 #if BLAZE_MIC_MODE
601  using IntrinsicType = __m512i;
602  BLAZE_ALWAYS_INLINE SIMDuint32() noexcept : value( _mm512_setzero_epi32() ) {}
603  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
604  enum : size_t { size = 16UL };
605 #elif BLAZE_AVX2_MODE
606  using IntrinsicType = __m256i;
607  BLAZE_ALWAYS_INLINE SIMDuint32() noexcept : value( _mm256_setzero_si256() ) {}
608  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
609  enum : size_t { size = 8UL };
610 #elif BLAZE_SSE2_MODE
611  using IntrinsicType = __m128i;
612  BLAZE_ALWAYS_INLINE SIMDuint32() noexcept : value( _mm_setzero_si128() ) {}
613  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
614  enum : size_t { size = 4UL };
615 #else
616  using IntrinsicType = ValueType;
617  BLAZE_ALWAYS_INLINE SIMDuint32() noexcept : value( 0 ) {}
618  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
619  enum : size_t { size = 1UL };
620 #endif
621 
622  BLAZE_ALWAYS_INLINE SIMDuint32( IntrinsicType v ) noexcept : value( v ) {}
623 
624  template< typename T >
625  BLAZE_ALWAYS_INLINE SIMDuint32( const SIMDi32<T>& v ) noexcept : value( (~v).value ) {}
626 
627  template< typename T >
628  BLAZE_ALWAYS_INLINE SIMDuint32& operator=( const SIMDi32<T>& v ) noexcept { value = (~v).value; return *this; }
629 
630  IntrinsicType value;
631 };
633 //*************************************************************************************************
634 
635 
636 
637 
638 //=================================================================================================
639 //
640 // 32-BIT INTEGRAL COMPLEX SIMD TYPES
641 //
642 //=================================================================================================
643 
644 //*************************************************************************************************
645 /*\class blaze::SIMDci32
646 // \brief Base class for all 32-bit integral complex SIMD data types.
647 // \ingroup simd
648 */
650 template< typename T > // Type of the SIMD element
651 struct SIMDci32 : public SIMDPack< T >
652 {};
654 //*************************************************************************************************
655 
656 
657 //*************************************************************************************************
663 struct SIMDcint32 : public SIMDci32< SIMDcint32 >
664 {
665  using This = SIMDcint32;
666  using BaseType = SIMDci32<This>;
667  using ValueType = complex<int32_t>;
668 
669 #if BLAZE_MIC_MODE
670  using IntrinsicType = __m512i;
671  BLAZE_ALWAYS_INLINE SIMDcint32() noexcept : value( _mm512_setzero_epi32() ) {}
672  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
673  enum : size_t { size = 8UL };
674 #elif BLAZE_AVX2_MODE
675  using IntrinsicType = __m256i;
676  BLAZE_ALWAYS_INLINE SIMDcint32() noexcept : value( _mm256_setzero_si256() ) {}
677  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
678  enum : size_t { size = 4UL };
679 #elif BLAZE_SSE2_MODE
680  using IntrinsicType = __m128i;
681  BLAZE_ALWAYS_INLINE SIMDcint32() noexcept : value( _mm_setzero_si128() ) {}
682  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
683  enum : size_t { size = 2UL };
684 #else
685  using IntrinsicType = ValueType;
686  BLAZE_ALWAYS_INLINE SIMDcint32() noexcept : value( 0, 0 ) {}
687  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
688  enum : size_t { size = 1UL };
689 #endif
690 
691  BLAZE_ALWAYS_INLINE SIMDcint32( IntrinsicType v ) noexcept : value( v ) {}
692 
693  template< typename T >
694  BLAZE_ALWAYS_INLINE SIMDcint32( const SIMDci32<T>& v ) noexcept : value( (~v).value ) {}
695 
696  template< typename T >
697  BLAZE_ALWAYS_INLINE SIMDcint32& operator=( const SIMDci32<T>& v ) noexcept { value = (~v).value; return *this; }
698 
699  IntrinsicType value;
700 };
702 //*************************************************************************************************
703 
704 
705 //*************************************************************************************************
711 struct SIMDcuint32 : public SIMDci32< SIMDcuint32 >
712 {
713  using This = SIMDcuint32;
714  using BaseType = SIMDci32<This>;
715  using ValueType = complex<uint32_t>;
716 
717 #if BLAZE_MIC_MODE
718  using IntrinsicType = __m512i;
719  BLAZE_ALWAYS_INLINE SIMDcuint32() noexcept : value( _mm512_setzero_epi32() ) {}
720  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
721  enum : size_t { size = 8UL };
722 #elif BLAZE_AVX2_MODE
723  using IntrinsicType = __m256i;
724  BLAZE_ALWAYS_INLINE SIMDcuint32() noexcept : value( _mm256_setzero_si256() ) {}
725  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
726  enum : size_t { size = 4UL };
727 #elif BLAZE_SSE2_MODE
728  using IntrinsicType = __m128i;
729  BLAZE_ALWAYS_INLINE SIMDcuint32() noexcept : value( _mm_setzero_si128() ) {}
730  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
731  enum : size_t { size = 2UL };
732 #else
733  using IntrinsicType = ValueType;
734  BLAZE_ALWAYS_INLINE SIMDcuint32() noexcept : value( 0, 0 ) {}
735  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
736  enum : size_t { size = 1UL };
737 #endif
738 
739  BLAZE_ALWAYS_INLINE SIMDcuint32( IntrinsicType v ) noexcept : value( v ) {}
740 
741  template< typename T >
742  BLAZE_ALWAYS_INLINE SIMDcuint32( const SIMDci32<T>& v ) noexcept : value( (~v).value ) {}
743 
744  template< typename T >
745  BLAZE_ALWAYS_INLINE SIMDcuint32& operator=( const SIMDci32<T>& v ) noexcept { value = (~v).value; return *this; }
746 
747  IntrinsicType value;
748 };
750 //*************************************************************************************************
751 
752 
753 
754 
755 //=================================================================================================
756 //
757 // 64-BIT INTEGRAL SIMD TYPES
758 //
759 //=================================================================================================
760 
761 //*************************************************************************************************
762 /*\class blaze::SIMDi64
763 // \brief Base class for all 64-bit integral SIMD data types.
764 // \ingroup simd
765 */
767 template< typename T > // Type of the SIMD element
768 struct SIMDi64 : public SIMDPack< T >
769 {};
771 //*************************************************************************************************
772 
773 
774 //*************************************************************************************************
780 struct SIMDint64 : public SIMDi64< SIMDint64 >
781 {
782  using This = SIMDint64;
783  using BaseType = SIMDi64<This>;
784  using ValueType = int64_t;
785 
786 #if BLAZE_MIC_MODE
787  using IntrinsicType = __m512i;
788  BLAZE_ALWAYS_INLINE SIMDint64() noexcept : value( _mm512_setzero_epi32() ) {}
789  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
790  enum : size_t { size = 8UL };
791 #elif BLAZE_AVX2_MODE
792  using IntrinsicType = __m256i;
793  BLAZE_ALWAYS_INLINE SIMDint64() noexcept : value( _mm256_setzero_si256() ) {}
794  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
795  enum : size_t { size = 4UL };
796 #elif BLAZE_SSE2_MODE
797  using IntrinsicType = __m128i;
798  BLAZE_ALWAYS_INLINE SIMDint64() noexcept : value( _mm_setzero_si128() ) {}
799  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
800  enum : size_t { size = 2UL };
801 #else
802  using IntrinsicType = ValueType;
803  BLAZE_ALWAYS_INLINE SIMDint64() noexcept : value( 0L ) {}
804  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
805  enum : size_t { size = 1UL };
806 #endif
807 
808  BLAZE_ALWAYS_INLINE SIMDint64( IntrinsicType v ) noexcept : value( v ) {}
809 
810  template< typename T >
811  BLAZE_ALWAYS_INLINE SIMDint64( const SIMDi64<T>& v ) noexcept : value( (~v).value ) {}
812 
813  template< typename T >
814  BLAZE_ALWAYS_INLINE SIMDint64& operator=( const SIMDi64<T>& v ) noexcept { value = (~v).value; return *this; }
815 
816  IntrinsicType value;
817 };
819 //*************************************************************************************************
820 
821 
822 //*************************************************************************************************
828 struct SIMDuint64 : public SIMDi64< SIMDuint64 >
829 {
830  using This = SIMDuint64;
831  using BaseType = SIMDi64<This>;
832  using ValueType = uint64_t;
833 
834 #if BLAZE_MIC_MODE
835  using IntrinsicType = __m512i;
836  BLAZE_ALWAYS_INLINE SIMDuint64() noexcept : value( _mm512_setzero_epi32() ) {}
837  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
838  enum : size_t { size = 8UL };
839 #elif BLAZE_AVX2_MODE
840  using IntrinsicType = __m256i;
841  BLAZE_ALWAYS_INLINE SIMDuint64() noexcept : value( _mm256_setzero_si256() ) {}
842  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
843  enum : size_t { size = 4UL };
844 #elif BLAZE_SSE2_MODE
845  using IntrinsicType = __m128i;
846  BLAZE_ALWAYS_INLINE SIMDuint64() noexcept : value( _mm_setzero_si128() ) {}
847  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
848  enum : size_t { size = 2UL };
849 #else
850  using IntrinsicType = ValueType;
851  BLAZE_ALWAYS_INLINE SIMDuint64() noexcept : value( 0L ) {}
852  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
853  enum : size_t { size = 1UL };
854 #endif
855 
856  BLAZE_ALWAYS_INLINE SIMDuint64( IntrinsicType v ) noexcept : value( v ) {}
857 
858  template< typename T >
859  BLAZE_ALWAYS_INLINE SIMDuint64( const SIMDi64<T>& v ) noexcept : value( (~v).value ) {}
860 
861  template< typename T >
862  BLAZE_ALWAYS_INLINE SIMDuint64& operator=( const SIMDi64<T>& v ) noexcept { value = (~v).value; return *this; }
863 
864  IntrinsicType value;
865 };
867 //*************************************************************************************************
868 
869 
870 
871 
872 //=================================================================================================
873 //
874 // 64-BIT INTEGRAL COMPLEX SIMD TYPES
875 //
876 //=================================================================================================
877 
878 //*************************************************************************************************
879 /*\class blaze::SIMDci64
880 // \brief Base class for all 64-bit integral complex SIMD data types.
881 // \ingroup simd
882 */
884 template< typename T > // Type of the SIMD element
885 struct SIMDci64 : public SIMDPack< T >
886 {};
888 //*************************************************************************************************
889 
890 
891 //*************************************************************************************************
897 struct SIMDcint64 : public SIMDci64< SIMDcint64 >
898 {
899  using This = SIMDcint64;
900  using BaseType = SIMDci64<This>;
901  using ValueType = complex<int64_t>;
902 
903 #if BLAZE_MIC_MODE
904  using IntrinsicType = __m512i;
905  BLAZE_ALWAYS_INLINE SIMDcint64() noexcept : value( _mm512_setzero_epi32() ) {}
906  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
907  enum : size_t { size = 4UL };
908 #elif BLAZE_AVX2_MODE
909  using IntrinsicType = __m256i;
910  BLAZE_ALWAYS_INLINE SIMDcint64() noexcept : value( _mm256_setzero_si256() ) {}
911  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
912  enum : size_t { size = 2UL };
913 #elif BLAZE_SSE2_MODE
914  using IntrinsicType = __m128i;
915  BLAZE_ALWAYS_INLINE SIMDcint64() noexcept : value( _mm_setzero_si128() ) {}
916  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
917  enum : size_t { size = 1UL };
918 #else
919  using IntrinsicType = ValueType;
920  BLAZE_ALWAYS_INLINE SIMDcint64() noexcept : value( 0L, 0L ) {}
921  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
922  enum : size_t { size = 1UL };
923 #endif
924 
925  BLAZE_ALWAYS_INLINE SIMDcint64( IntrinsicType v ) noexcept : value( v ) {}
926 
927  template< typename T >
928  BLAZE_ALWAYS_INLINE SIMDcint64( const SIMDci64<T>& v ) noexcept : value( (~v).value ) {}
929 
930  template< typename T >
931  BLAZE_ALWAYS_INLINE SIMDcint64& operator=( const SIMDci64<T>& v ) noexcept { value = (~v).value; return *this; }
932 
933  IntrinsicType value;
934 };
936 //*************************************************************************************************
937 
938 
939 //*************************************************************************************************
945 struct SIMDcuint64 : public SIMDci64< SIMDcuint64 >
946 {
947  using This = SIMDcuint64;
948  using BaseType = SIMDci64<This>;
949  using ValueType = complex<uint64_t>;
950 
951 #if BLAZE_MIC_MODE
952  using IntrinsicType = __m512i;
953  BLAZE_ALWAYS_INLINE SIMDcuint64() noexcept : value( _mm512_setzero_epi32() ) {}
954  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
955  enum : size_t { size = 4UL };
956 #elif BLAZE_AVX2_MODE
957  using IntrinsicType = __m256i;
958  BLAZE_ALWAYS_INLINE SIMDcuint64() noexcept : value( _mm256_setzero_si256() ) {}
959  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
960  enum : size_t { size = 2UL };
961 #elif BLAZE_SSE2_MODE
962  using IntrinsicType = __m128i;
963  BLAZE_ALWAYS_INLINE SIMDcuint64() noexcept : value( _mm_setzero_si128() ) {}
964  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
965  enum : size_t { size = 1UL };
966 #else
967  using IntrinsicType = ValueType;
968  BLAZE_ALWAYS_INLINE SIMDcuint64() noexcept : value( 0L, 0L ) {}
969  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
970  enum : size_t { size = 1UL };
971 #endif
972 
973  BLAZE_ALWAYS_INLINE SIMDcuint64( IntrinsicType v ) noexcept : value( v ) {}
974 
975  template< typename T >
976  BLAZE_ALWAYS_INLINE SIMDcuint64( const SIMDci64<T>& v ) noexcept : value( (~v).value ) {}
977 
978  template< typename T >
979  BLAZE_ALWAYS_INLINE SIMDcuint64& operator=( const SIMDci64<T>& v ) noexcept { value = (~v).value; return *this; }
980 
981  IntrinsicType value;
982 };
984 //*************************************************************************************************
985 
986 
987 
988 
989 //=================================================================================================
990 //
991 // SINGLE PRECISION FLOATING POINT SIMD TYPES
992 //
993 //=================================================================================================
994 
995 //*************************************************************************************************
996 /*\class blaze::SIMDf32
997 // \brief Base class for all single precision floating point SIMD data types.
998 // \ingroup simd
999 */
1001 template< typename T > // Type of the SIMD element
1002 struct SIMDf32 : public SIMDPack< T >
1003 {};
1005 //*************************************************************************************************
1006 
1007 
1008 //*************************************************************************************************
1014 struct SIMDfloat : public SIMDf32< SIMDfloat >
1015 {
1016  using This = SIMDfloat;
1017  using BaseType = SIMDf32<This>;
1018  using ValueType = float;
1019 
1020 #if BLAZE_MIC_MODE
1021  using IntrinsicType = __m512;
1022  BLAZE_ALWAYS_INLINE SIMDfloat() noexcept : value( _mm512_setzero_ps() ) {}
1023  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
1024  enum : size_t { size = 16UL };
1025 #elif BLAZE_AVX_MODE
1026  using IntrinsicType = __m256;
1027  BLAZE_ALWAYS_INLINE SIMDfloat() noexcept : value( _mm256_setzero_ps() ) {}
1028  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
1029  enum : size_t { size = 8UL };
1030 #elif BLAZE_SSE_MODE
1031  using IntrinsicType = __m128;
1032  BLAZE_ALWAYS_INLINE SIMDfloat() noexcept : value( _mm_setzero_ps() ) {}
1033  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
1034  enum : size_t { size = 4UL };
1035 #else
1036  using IntrinsicType = ValueType;
1037  BLAZE_ALWAYS_INLINE SIMDfloat() noexcept : value( 0.0F ) {}
1038  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
1039  enum : size_t { size = 1UL };
1040 #endif
1041 
1042  BLAZE_ALWAYS_INLINE SIMDfloat( IntrinsicType v ) noexcept : value( v ) {}
1043 
1044  template< typename T >
1045  BLAZE_ALWAYS_INLINE SIMDfloat( const SIMDf32<T>& v ) noexcept : value( (~v).eval().value ) {}
1046 
1047  template< typename T >
1048  BLAZE_ALWAYS_INLINE SIMDfloat& operator=( const SIMDf32<T>& v ) noexcept { value = (~v).eval().value; return *this; }
1049 
1050  BLAZE_ALWAYS_INLINE const This& eval() const { return *this; }
1051 
1052  IntrinsicType value;
1053 };
1055 //*************************************************************************************************
1056 
1057 
1058 
1059 
1060 //=================================================================================================
1061 //
1062 // SINGLE PRECISION FLOATING POINT COMPLEX SIMD TYPES
1063 //
1064 //=================================================================================================
1065 
1066 //*************************************************************************************************
1067 /*\class blaze::SIMDcf32
1068 // \brief Base class for all single precision floating point complex SIMD data types.
1069 // \ingroup simd
1070 */
1072 template< typename T > // Type of the SIMD element
1073 struct SIMDcf32 : public SIMDPack< T >
1074 {};
1076 //*************************************************************************************************
1077 
1078 
1079 //*************************************************************************************************
1085 struct SIMDcfloat : public SIMDcf32< SIMDcfloat >
1086 {
1087  using This = SIMDcfloat;
1088  using BaseType = SIMDcf32<This>;
1089  using ValueType = complex<float>;
1090 
1091 #if BLAZE_MIC_MODE
1092  using IntrinsicType = __m512;
1093  BLAZE_ALWAYS_INLINE SIMDcfloat() noexcept : value( _mm512_setzero_ps() ) {}
1094  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
1095  enum : size_t { size = 8UL };
1096 #elif BLAZE_AVX_MODE
1097  using IntrinsicType = __m256;
1098  BLAZE_ALWAYS_INLINE SIMDcfloat() noexcept : value( _mm256_setzero_ps() ) {}
1099  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
1100  enum : size_t { size = 4UL };
1101 #elif BLAZE_SSE_MODE
1102  using IntrinsicType = __m128;
1103  BLAZE_ALWAYS_INLINE SIMDcfloat() noexcept : value( _mm_setzero_ps() ) {}
1104  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
1105  enum : size_t { size = 2UL };
1106 #else
1107  using IntrinsicType = ValueType;
1108  BLAZE_ALWAYS_INLINE SIMDcfloat() noexcept : value( 0.0F, 0.0F ) {}
1109  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
1110  enum : size_t { size = 1UL };
1111 #endif
1112 
1113  BLAZE_ALWAYS_INLINE SIMDcfloat( IntrinsicType v ) noexcept : value( v ) {}
1114 
1115  template< typename T >
1116  BLAZE_ALWAYS_INLINE SIMDcfloat( const SIMDcf32<T>& v ) noexcept : value( (~v).value ) {}
1117 
1118  template< typename T >
1119  BLAZE_ALWAYS_INLINE SIMDcfloat& operator=( const SIMDcf32<T>& v ) noexcept { value = (~v).value; return *this; }
1120 
1121  IntrinsicType value;
1122 };
1124 //*************************************************************************************************
1125 
1126 
1127 
1128 
1129 //=================================================================================================
1130 //
1131 // DOUBLE PRECISION FLOATING POINT SIMD TYPES
1132 //
1133 //=================================================================================================
1134 
1135 //*************************************************************************************************
1136 /*\class blaze::SIMDf64
1137 // \brief Base class for all double precision floating point SIMD data types.
1138 // \ingroup simd
1139 */
1141 template< typename T > // Type of the SIMD element
1142 struct SIMDf64 : public SIMDPack< T >
1143 {};
1145 //*************************************************************************************************
1146 
1147 
1148 //*************************************************************************************************
1154 struct SIMDdouble : public SIMDf64< SIMDdouble >
1155 {
1156  using This = SIMDdouble;
1157  using BaseType = SIMDf64<This>;
1158  using ValueType = double;
1159 
1160 #if BLAZE_MIC_MODE
1161  using IntrinsicType = __m512d;
1162  BLAZE_ALWAYS_INLINE SIMDdouble() noexcept : value( _mm512_setzero_pd() ) {}
1163  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
1164  enum : size_t { size = 8UL };
1165 #elif BLAZE_AVX_MODE
1166  using IntrinsicType = __m256d;
1167  BLAZE_ALWAYS_INLINE SIMDdouble() noexcept : value( _mm256_setzero_pd() ) {}
1168  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
1169  enum : size_t { size = 4UL };
1170 #elif BLAZE_SSE2_MODE
1171  using IntrinsicType = __m128d;
1172  BLAZE_ALWAYS_INLINE SIMDdouble() noexcept : value( _mm_setzero_pd() ) {}
1173  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
1174  enum : size_t { size = 2UL };
1175 #else
1176  using IntrinsicType = ValueType;
1177  BLAZE_ALWAYS_INLINE SIMDdouble() noexcept : value( 0.0 ) {}
1178  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
1179  enum : size_t { size = 1UL };
1180 #endif
1181 
1182  BLAZE_ALWAYS_INLINE SIMDdouble( IntrinsicType v ) noexcept : value( v ) {}
1183 
1184  template< typename T >
1185  BLAZE_ALWAYS_INLINE SIMDdouble( const SIMDf64<T>& v ) noexcept : value( (~v).eval().value ) {}
1186 
1187  template< typename T >
1188  BLAZE_ALWAYS_INLINE SIMDdouble& operator=( const SIMDf64<T>& v ) noexcept { value = (~v).eval().value; return *this; }
1189 
1190  BLAZE_ALWAYS_INLINE const This& eval() const { return *this; }
1191 
1192  IntrinsicType value;
1193 };
1195 //*************************************************************************************************
1196 
1197 
1198 
1199 
1200 //=================================================================================================
1201 //
1202 // DOUBLE PRECISION FLOATING POINT COMPLEX SIMD TYPES
1203 //
1204 //=================================================================================================
1205 
1206 //*************************************************************************************************
1207 /*\class blaze::SIMDcf64
1208 // \brief Base class for all double precision floating point complex SIMD data types.
1209 // \ingroup simd
1210 */
1212 template< typename T > // Type of the SIMD element
1213 struct SIMDcf64 : public SIMDPack< T >
1214 {};
1216 //*************************************************************************************************
1217 
1218 
1219 //*************************************************************************************************
1225 struct SIMDcdouble : public SIMDcf64< SIMDcdouble >
1226 {
1227  using This = SIMDcdouble;
1228  using BaseType = SIMDcf64<This>;
1229  using ValueType = complex<double>;
1230 
1231 #if BLAZE_MIC_MODE
1232  using IntrinsicType = __m512d;
1233  BLAZE_ALWAYS_INLINE SIMDcdouble() noexcept : value( _mm512_setzero_pd() ) {}
1234  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
1235  enum : size_t { size = 4UL };
1236 #elif BLAZE_AVX_MODE
1237  using IntrinsicType = __m256d;
1238  BLAZE_ALWAYS_INLINE SIMDcdouble() noexcept : value( _mm256_setzero_pd() ) {}
1239  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
1240  enum : size_t { size = 2UL };
1241 #elif BLAZE_SSE2_MODE
1242  using IntrinsicType = __m128d;
1243  BLAZE_ALWAYS_INLINE SIMDcdouble() noexcept : value( _mm_setzero_pd() ) {}
1244  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
1245  enum : size_t { size = 1UL };
1246 #else
1247  using IntrinsicType = ValueType;
1248  BLAZE_ALWAYS_INLINE SIMDcdouble() noexcept : value( 0.0, 0.0 ) {}
1249  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
1250  enum : size_t { size = 1UL };
1251 #endif
1252 
1253  BLAZE_ALWAYS_INLINE SIMDcdouble( IntrinsicType v ) noexcept : value( v ) {}
1254 
1255  template< typename T >
1256  BLAZE_ALWAYS_INLINE SIMDcdouble( const SIMDcf64<T>& v ) noexcept : value( (~v).value ) {}
1257 
1258  template< typename T >
1259  BLAZE_ALWAYS_INLINE SIMDcdouble& operator=( const SIMDcf64<T>& v ) noexcept { value = (~v).value; return *this; }
1260 
1261  IntrinsicType value;
1262 };
1264 //*************************************************************************************************
1265 
1266 
1267 
1268 
1269 //=================================================================================================
1270 //
1271 // SIMD OPERATORS
1272 //
1273 //=================================================================================================
1274 
1275 //*************************************************************************************************
1283 template< typename T1 // Type of the left-hand side SIMD operand
1284  , typename T2 > // Type of the right-hand side SIMD operand
1286 {
1287  (~lhs) = (~lhs) + (~rhs);
1288  return ~lhs;
1289 }
1290 //*************************************************************************************************
1291 
1292 
1293 //*************************************************************************************************
1301 template< typename T1 // Type of the left-hand side SIMD operand
1302  , typename T2 > // Type of the right-hand side SIMD operand
1304 {
1305  (~lhs) = (~lhs) - (~rhs);
1306  return ~lhs;
1307 }
1308 //*************************************************************************************************
1309 
1310 
1311 //*************************************************************************************************
1319 template< typename T1 // Type of the left-hand side SIMD operand
1320  , typename T2 > // Type of the right-hand side SIMD operand
1322 {
1323  (~lhs) = (~lhs) * (~rhs);
1324  return ~lhs;
1325 }
1326 //*************************************************************************************************
1327 
1328 
1329 //*************************************************************************************************
1337 template< typename T1 // Type of the left-hand side SIMD operand
1338  , typename T2 > // Type of the right-hand side SIMD operand
1340 {
1341  (~lhs) = (~lhs) / (~rhs);
1342  return ~lhs;
1343 }
1344 //*************************************************************************************************
1345 
1346 } // namespace blaze
1347 
1348 #endif
Header file for basic type definitions.
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:258
BLAZE_ALWAYS_INLINE T1 & operator/=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Division assignment operator for the division of two SIMD packs.
Definition: BasicTypes.h:1339
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:2636
BLAZE_ALWAYS_INLINE T1 & operator*=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Multiplication assignment operator for the multiplication of two SIMD packs.
Definition: BasicTypes.h:1321
Header file for the SIMDPack base class.
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
Base class for all SIMD data types.The SIMDPack class template is a base class for all SIMD data type...
Definition: SIMDPack.h:63
BLAZE_ALWAYS_INLINE T1 & operator+=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Addition assignment operator for the addition of two SIMD packs.
Definition: BasicTypes.h:1285
const DMatEvalExpr< MT, SO > eval(const DenseMatrix< MT, SO > &dm)
Forces the evaluation of the given dense matrix expression dm.
Definition: DMatEvalExpr.h:705
SparseMatrix< This, true > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:2637
System settings for the SSE mode.
Header file for the complex data type.
BLAZE_ALWAYS_INLINE T1 & operator-=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Subtraction assignment operator for the subtraction of two SIMD packs.
Definition: BasicTypes.h:1303
System settings for the inline keywords.
Header file for the TrueType type/value trait base class.