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
67  : public SIMDPack< T >
68 {};
70 //*************************************************************************************************
71 
72 
73 //*************************************************************************************************
79 struct SIMDint8
80  : public SIMDi8< SIMDint8 >
81 {
82  using This = SIMDint8;
83  using BaseType = SIMDi8<This>;
84  using ValueType = int8_t;
85 
86 #if BLAZE_AVX512BW_MODE
87  using IntrinsicType = __m512i;
88  BLAZE_ALWAYS_INLINE SIMDint8() noexcept : value( _mm512_setzero_epi32() ) {}
89  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
90  enum : size_t { size = 64UL };
91 #elif BLAZE_MIC_MODE
92  using IntrinsicType = ValueType;
93  BLAZE_ALWAYS_INLINE SIMDint8() noexcept : value( 0 ) {}
94  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
95  enum : size_t { size = 1UL };
96 #elif BLAZE_AVX2_MODE
97  using IntrinsicType = __m256i;
98  BLAZE_ALWAYS_INLINE SIMDint8() noexcept : value( _mm256_setzero_si256() ) {}
99  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
100  enum : size_t { size = 32UL };
101 #elif BLAZE_SSE2_MODE
102  using IntrinsicType = __m128i;
103  BLAZE_ALWAYS_INLINE SIMDint8() noexcept : value( _mm_setzero_si128() ) {}
104  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
105  enum : size_t { size = 16UL };
106 #else
107  using IntrinsicType = ValueType;
108  BLAZE_ALWAYS_INLINE SIMDint8() noexcept : value( 0 ) {}
109  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
110  enum : size_t { size = 1UL };
111 #endif
112 
113  BLAZE_ALWAYS_INLINE SIMDint8( IntrinsicType v ) noexcept : value( v ) {}
114 
115  template< typename T >
116  BLAZE_ALWAYS_INLINE SIMDint8( const SIMDi8<T>& v ) noexcept : value( (~v).value ) {}
117 
118  template< typename T >
119  BLAZE_ALWAYS_INLINE SIMDint8& operator=( const SIMDi8<T>& v ) noexcept { value = (~v).value; return *this; }
120 
121  IntrinsicType value;
122 };
124 //*************************************************************************************************
125 
126 
127 //*************************************************************************************************
133 struct SIMDuint8
134  : public SIMDi8< SIMDuint8 >
135 {
136  using This = SIMDuint8;
137  using BaseType = SIMDi8<This>;
138  using ValueType = uint8_t;
139 
140 #if BLAZE_AVX512BW_MODE
141  using IntrinsicType = __m512i;
142  BLAZE_ALWAYS_INLINE SIMDuint8() noexcept : value( _mm512_setzero_epi32() ) {}
143  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
144  enum : size_t { size = 64UL };
145 #elif BLAZE_MIC_MODE
146  using IntrinsicType = ValueType;
147  BLAZE_ALWAYS_INLINE SIMDuint8() noexcept : value( 0 ) {}
148  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
149  enum : size_t { size = 1UL };
150 #elif BLAZE_AVX2_MODE
151  using IntrinsicType = __m256i;
152  BLAZE_ALWAYS_INLINE SIMDuint8() noexcept : value( _mm256_setzero_si256() ) {}
153  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
154  enum : size_t { size = 32UL };
155 #elif BLAZE_SSE2_MODE
156  using IntrinsicType = __m128i;
157  BLAZE_ALWAYS_INLINE SIMDuint8() noexcept : value( _mm_setzero_si128() ) {}
158  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
159  enum : size_t { size = 16UL };
160 #else
161  using IntrinsicType = ValueType;
162  BLAZE_ALWAYS_INLINE SIMDuint8() noexcept : value( 0 ) {}
163  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
164  enum : size_t { size = 1UL };
165 #endif
166 
167  BLAZE_ALWAYS_INLINE SIMDuint8( IntrinsicType v ) noexcept : value( v ) {}
168 
169  template< typename T >
170  BLAZE_ALWAYS_INLINE SIMDuint8( const SIMDi8<T>& v ) noexcept : value( (~v).value ) {}
171 
172  template< typename T >
173  BLAZE_ALWAYS_INLINE SIMDuint8& operator=( const SIMDi8<T>& v ) noexcept { value = (~v).value; return *this; }
174 
175  IntrinsicType value;
176 };
178 //*************************************************************************************************
179 
180 
181 
182 
183 //=================================================================================================
184 //
185 // 8-BIT INTEGRAL COMPLEX SIMD TYPES
186 //
187 //=================================================================================================
188 
189 //*************************************************************************************************
190 /*\class blaze::SIMDci8
191 // \brief Base class for all 8-bit integral complex SIMD data types.
192 // \ingroup simd
193 */
195 template< typename T > // Type of the SIMD element
196 struct SIMDci8
197  : public SIMDPack< T >
198 {};
200 //*************************************************************************************************
201 
202 
203 //*************************************************************************************************
209 struct SIMDcint8
210  : public SIMDci8< SIMDcint8 >
211 {
212  using This = SIMDcint8;
213  using BaseType = SIMDci8<This>;
214  using ValueType = complex<int8_t>;
215 
216 #if BLAZE_AVX512BW_MODE
217  using IntrinsicType = __m512i;
218  BLAZE_ALWAYS_INLINE SIMDcint8() noexcept : value( _mm512_setzero_epi32() ) {}
219  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
220  enum : size_t { size = 32UL };
221 #elif BLAZE_MIC_MODE
222  using IntrinsicType = ValueType;
223  BLAZE_ALWAYS_INLINE SIMDcint8() noexcept : value( 0, 0 ) {}
224  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
225  enum : size_t { size = 1UL };
226 #elif BLAZE_AVX2_MODE
227  using IntrinsicType = __m256i;
228  BLAZE_ALWAYS_INLINE SIMDcint8() noexcept : value( _mm256_setzero_si256() ) {}
229  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
230  enum : size_t { size = 16UL };
231 #elif BLAZE_SSE2_MODE
232  using IntrinsicType = __m128i;
233  BLAZE_ALWAYS_INLINE SIMDcint8() noexcept : value( _mm_setzero_si128() ) {}
234  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
235  enum : size_t { size = 8UL };
236 #else
237  using IntrinsicType = ValueType;
238  BLAZE_ALWAYS_INLINE SIMDcint8() noexcept : value( 0, 0 ) {}
239  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
240  enum : size_t { size = 1UL };
241 #endif
242 
243  BLAZE_ALWAYS_INLINE SIMDcint8( IntrinsicType v ) noexcept : value( v ) {}
244 
245  template< typename T >
246  BLAZE_ALWAYS_INLINE SIMDcint8( const SIMDci8<T>& v ) noexcept : value( (~v).value ) {}
247 
248  template< typename T >
249  BLAZE_ALWAYS_INLINE SIMDcint8& operator=( const SIMDci8<T>& v ) noexcept { value = (~v).value; return *this; }
250 
251  IntrinsicType value;
252 };
254 //*************************************************************************************************
255 
256 
257 //*************************************************************************************************
263 struct SIMDcuint8
264  : public SIMDci8< SIMDcuint8 >
265 {
266  using This = SIMDcuint8;
267  using BaseType = SIMDci8<This>;
268  using ValueType = complex<uint8_t>;
269 
270 #if BLAZE_AVX512BW_MODE
271  using IntrinsicType = __m512i;
272  BLAZE_ALWAYS_INLINE SIMDcuint8() noexcept : value( _mm512_setzero_epi32() ) {}
273  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
274  enum : size_t { size = 32UL };
275 #elif BLAZE_MIC_MODE
276  using IntrinsicType = ValueType;
277  BLAZE_ALWAYS_INLINE SIMDcuint8() noexcept : value( 0, 0 ) {}
278  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
279  enum : size_t { size = 1UL };
280 #elif BLAZE_AVX2_MODE
281  using IntrinsicType = __m256i;
282  BLAZE_ALWAYS_INLINE SIMDcuint8() noexcept : value( _mm256_setzero_si256() ) {}
283  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
284  enum : size_t { size = 16UL };
285 #elif BLAZE_SSE2_MODE
286  using IntrinsicType = __m128i;
287  BLAZE_ALWAYS_INLINE SIMDcuint8() noexcept : value( _mm_setzero_si128() ) {}
288  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
289  enum : size_t { size = 8UL };
290 #else
291  using IntrinsicType = ValueType;
292  BLAZE_ALWAYS_INLINE SIMDcuint8() noexcept : value( 0, 0 ) {}
293  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
294  enum : size_t { size = 1UL };
295 #endif
296 
297  BLAZE_ALWAYS_INLINE SIMDcuint8( IntrinsicType v ) noexcept : value( v ) {}
298 
299  template< typename T >
300  BLAZE_ALWAYS_INLINE SIMDcuint8( const SIMDci8<T>& v ) noexcept : value( (~v).value ) {}
301 
302  template< typename T >
303  BLAZE_ALWAYS_INLINE SIMDcuint8& operator=( const SIMDci8<T>& v ) noexcept { value = (~v).value; return *this; }
304 
305  IntrinsicType value;
306 };
308 //*************************************************************************************************
309 
310 
311 
312 
313 //=================================================================================================
314 //
315 // 16-BIT INTEGRAL SIMD TYPES
316 //
317 //=================================================================================================
318 
319 //*************************************************************************************************
320 /*\class blaze::SIMDi16
321 // \brief Base class for all 16-bit integral SIMD data types.
322 // \ingroup simd
323 */
325 template< typename T > // Type of the SIMD element
326 struct SIMDi16
327  : public SIMDPack< T >
328 {};
330 //*************************************************************************************************
331 
332 
333 //*************************************************************************************************
339 struct SIMDint16
340  : public SIMDi16< SIMDint16 >
341 {
342  using This = SIMDint16;
343  using BaseType = SIMDi16<This>;
344  using ValueType = int16_t;
345 
346 #if BLAZE_AVX512BW_MODE
347  using IntrinsicType = __m512i;
348  BLAZE_ALWAYS_INLINE SIMDint16() noexcept : value( _mm512_setzero_epi32() ) {}
349  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
350  enum : size_t { size = 32UL };
351 #elif BLAZE_MIC_MODE
352  using IntrinsicType = ValueType;
353  BLAZE_ALWAYS_INLINE SIMDint16() noexcept : value( 0 ) {}
354  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
355  enum : size_t { size = 1UL };
356 #elif BLAZE_AVX2_MODE
357  using IntrinsicType = __m256i;
358  BLAZE_ALWAYS_INLINE SIMDint16() noexcept : value( _mm256_setzero_si256() ) {}
359  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
360  enum : size_t { size = 16UL };
361 #elif BLAZE_SSE2_MODE
362  using IntrinsicType = __m128i;
363  BLAZE_ALWAYS_INLINE SIMDint16() noexcept : value( _mm_setzero_si128() ) {}
364  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
365  enum : size_t { size = 8UL };
366 #else
367  using IntrinsicType = ValueType;
368  BLAZE_ALWAYS_INLINE SIMDint16() noexcept : value( 0 ) {}
369  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
370  enum : size_t { size = 1UL };
371 #endif
372 
373  BLAZE_ALWAYS_INLINE SIMDint16( IntrinsicType v ) noexcept : value( v ) {}
374 
375  template< typename T >
376  BLAZE_ALWAYS_INLINE SIMDint16( const SIMDi16<T>& v ) noexcept : value( (~v).value ) {}
377 
378  template< typename T >
379  BLAZE_ALWAYS_INLINE SIMDint16& operator=( const SIMDi16<T>& v ) noexcept { value = (~v).value; return *this; }
380 
381  IntrinsicType value;
382 };
384 //*************************************************************************************************
385 
386 
387 //*************************************************************************************************
393 struct SIMDuint16
394  : public SIMDi16< SIMDuint16 >
395 {
396  using This = SIMDuint16;
397  using BaseType = SIMDi16<This>;
398  using ValueType = uint16_t;
399 
400 #if BLAZE_AVX512BW_MODE
401  using IntrinsicType = __m512i;
402  BLAZE_ALWAYS_INLINE SIMDuint16() noexcept : value( _mm512_setzero_epi32() ) {}
403  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
404  enum : size_t { size = 32UL };
405 #elif BLAZE_MIC_MODE
406  using IntrinsicType = ValueType;
407  BLAZE_ALWAYS_INLINE SIMDuint16() noexcept : value( 0 ) {}
408  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
409  enum : size_t { size = 1UL };
410 #elif BLAZE_AVX2_MODE
411  using IntrinsicType = __m256i;
412  BLAZE_ALWAYS_INLINE SIMDuint16() noexcept : value( _mm256_setzero_si256() ) {}
413  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
414  enum : size_t { size = 16UL };
415 #elif BLAZE_SSE2_MODE
416  using IntrinsicType = __m128i;
417  BLAZE_ALWAYS_INLINE SIMDuint16() noexcept : value( _mm_setzero_si128() ) {}
418  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
419  enum : size_t { size = 8UL };
420 #else
421  using IntrinsicType = ValueType;
422  BLAZE_ALWAYS_INLINE SIMDuint16() noexcept : value( 0 ) {}
423  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
424  enum : size_t { size = 1UL };
425 #endif
426 
427  BLAZE_ALWAYS_INLINE SIMDuint16( IntrinsicType v ) noexcept : value( v ) {}
428 
429  template< typename T >
430  BLAZE_ALWAYS_INLINE SIMDuint16( const SIMDi16<T>& v ) noexcept : value( (~v).value ) {}
431 
432  template< typename T >
433  BLAZE_ALWAYS_INLINE SIMDuint16& operator=( const SIMDi16<T>& v ) noexcept { value = (~v).value; return *this; }
434 
435  IntrinsicType value;
436 };
438 //*************************************************************************************************
439 
440 
441 
442 
443 //=================================================================================================
444 //
445 // 16-BIT INTEGRAL COMPLEX SIMD TYPES
446 //
447 //=================================================================================================
448 
449 //*************************************************************************************************
450 /*\class blaze::SIMDci16
451 // \brief Base class for all 16-bit integral complex SIMD data types.
452 // \ingroup simd
453 */
455 template< typename T > // Type of the SIMD element
456 struct SIMDci16
457  : public SIMDPack< T >
458 {};
460 //*************************************************************************************************
461 
462 
463 //*************************************************************************************************
469 struct SIMDcint16
470  : public SIMDci16< SIMDcint16 >
471 {
472  using This = SIMDcint16;
473  using BaseType = SIMDci16<This>;
474  using ValueType = complex<int16_t>;
475 
476 #if BLAZE_AVX512BW_MODE
477  using IntrinsicType = __m512i;
478  BLAZE_ALWAYS_INLINE SIMDcint16() noexcept : value( _mm512_setzero_epi32() ) {}
479  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
480  enum : size_t { size = 16UL };
481 #elif BLAZE_MIC_MODE
482  using IntrinsicType = ValueType;
483  BLAZE_ALWAYS_INLINE SIMDcint16() noexcept : value( 0, 0 ) {}
484  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
485  enum : size_t { size = 1UL };
486 #elif BLAZE_AVX2_MODE
487  using IntrinsicType = __m256i;
488  BLAZE_ALWAYS_INLINE SIMDcint16() noexcept : value( _mm256_setzero_si256() ) {}
489  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
490  enum : size_t { size = 8UL };
491 #elif BLAZE_SSE2_MODE
492  using IntrinsicType = __m128i;
493  BLAZE_ALWAYS_INLINE SIMDcint16() noexcept : value( _mm_setzero_si128() ) {}
494  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
495  enum : size_t { size = 4UL };
496 #else
497  using IntrinsicType = ValueType;
498  BLAZE_ALWAYS_INLINE SIMDcint16() noexcept : value( 0, 0 ) {}
499  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
500  enum : size_t { size = 1UL };
501 #endif
502 
503  BLAZE_ALWAYS_INLINE SIMDcint16( IntrinsicType v ) noexcept : value( v ) {}
504 
505  template< typename T >
506  BLAZE_ALWAYS_INLINE SIMDcint16( const SIMDci16<T>& v ) noexcept : value( (~v).value ) {}
507 
508  template< typename T >
509  BLAZE_ALWAYS_INLINE SIMDcint16& operator=( const SIMDci16<T>& v ) noexcept { value = (~v).value; return *this; }
510 
511  IntrinsicType value;
512 };
514 //*************************************************************************************************
515 
516 
517 //*************************************************************************************************
523 struct SIMDcuint16
524  : public SIMDci16< SIMDcuint16 >
525 {
526  using This = SIMDcuint16;
527  using BaseType = SIMDci16<This>;
528  using ValueType = complex<uint16_t>;
529 
530 #if BLAZE_AVX512BW_MODE
531  using IntrinsicType = __m512i;
532  BLAZE_ALWAYS_INLINE SIMDcuint16() noexcept : value( _mm512_setzero_epi32() ) {}
533  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
534  enum : size_t { size = 16UL };
535 #elif BLAZE_MIC_MODE
536  using IntrinsicType = ValueType;
537  BLAZE_ALWAYS_INLINE SIMDcuint16() noexcept : value( 0, 0 ) {}
538  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
539  enum : size_t { size = 1UL };
540 #elif BLAZE_AVX2_MODE
541  using IntrinsicType = __m256i;
542  BLAZE_ALWAYS_INLINE SIMDcuint16() noexcept : value( _mm256_setzero_si256() ) {}
543  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
544  enum : size_t { size = 8UL };
545 #elif BLAZE_SSE2_MODE
546  using IntrinsicType = __m128i;
547  BLAZE_ALWAYS_INLINE SIMDcuint16() noexcept : value( _mm_setzero_si128() ) {}
548  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
549  enum : size_t { size = 4UL };
550 #else
551  using IntrinsicType = ValueType;
552  BLAZE_ALWAYS_INLINE SIMDcuint16() noexcept : value( 0, 0 ) {}
553  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
554  enum : size_t { size = 1UL };
555 #endif
556 
557  BLAZE_ALWAYS_INLINE SIMDcuint16( IntrinsicType v ) noexcept : value( v ) {}
558 
559  template< typename T >
560  BLAZE_ALWAYS_INLINE SIMDcuint16( const SIMDci16<T>& v ) noexcept : value( (~v).value ) {}
561 
562  template< typename T >
563  BLAZE_ALWAYS_INLINE SIMDcuint16& operator=( const SIMDci16<T>& v ) noexcept { value = (~v).value; return *this; }
564 
565  IntrinsicType value;
566 };
568 //*************************************************************************************************
569 
570 
571 
572 
573 //=================================================================================================
574 //
575 // 32-BIT INTEGRAL SIMD TYPES
576 //
577 //=================================================================================================
578 
579 //*************************************************************************************************
580 /*\class blaze::SIMDi32
581 // \brief Base class for all 32-bit integral SIMD data types.
582 // \ingroup simd
583 */
585 template< typename T > // Type of the SIMD element
586 struct SIMDi32
587  : public SIMDPack< T >
588 {};
590 //*************************************************************************************************
591 
592 
593 //*************************************************************************************************
599 struct SIMDint32
600  : public SIMDi32< SIMDint32 >
601 {
602  using This = SIMDint32;
603  using BaseType = SIMDi32<This>;
604  using ValueType = int32_t;
605 
606 #if BLAZE_AVX512F_MODE || BLAZE_MIC_MODE
607  using IntrinsicType = __m512i;
608  BLAZE_ALWAYS_INLINE SIMDint32() noexcept : value( _mm512_setzero_epi32() ) {}
609  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
610  enum : size_t { size = 16UL };
611 #elif BLAZE_AVX2_MODE
612  using IntrinsicType = __m256i;
613  BLAZE_ALWAYS_INLINE SIMDint32() noexcept : value( _mm256_setzero_si256() ) {}
614  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
615  enum : size_t { size = 8UL };
616 #elif BLAZE_SSE2_MODE
617  using IntrinsicType = __m128i;
618  BLAZE_ALWAYS_INLINE SIMDint32() noexcept : value( _mm_setzero_si128() ) {}
619  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
620  enum : size_t { size = 4UL };
621 #else
622  using IntrinsicType = ValueType;
623  BLAZE_ALWAYS_INLINE SIMDint32() noexcept : value( 0 ) {}
624  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
625  enum : size_t { size = 1UL };
626 #endif
627 
628  BLAZE_ALWAYS_INLINE SIMDint32( IntrinsicType v ) noexcept : value( v ) {}
629 
630  template< typename T >
631  BLAZE_ALWAYS_INLINE SIMDint32( const SIMDi32<T>& v ) noexcept : value( (~v).value ) {}
632 
633  template< typename T >
634  BLAZE_ALWAYS_INLINE SIMDint32& operator=( const SIMDi32<T>& v ) noexcept { value = (~v).value; return *this; }
635 
636  IntrinsicType value;
637 };
639 //*************************************************************************************************
640 
641 
642 //*************************************************************************************************
648 struct SIMDuint32
649  : public SIMDi32< SIMDuint32 >
650 {
651  using This = SIMDuint32;
652  using BaseType = SIMDi32<This>;
653  using ValueType = uint32_t;
654 
655 #if BLAZE_AVX512F_MODE || BLAZE_MIC_MODE
656  using IntrinsicType = __m512i;
657  BLAZE_ALWAYS_INLINE SIMDuint32() noexcept : value( _mm512_setzero_epi32() ) {}
658  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
659  enum : size_t { size = 16UL };
660 #elif BLAZE_AVX2_MODE
661  using IntrinsicType = __m256i;
662  BLAZE_ALWAYS_INLINE SIMDuint32() noexcept : value( _mm256_setzero_si256() ) {}
663  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
664  enum : size_t { size = 8UL };
665 #elif BLAZE_SSE2_MODE
666  using IntrinsicType = __m128i;
667  BLAZE_ALWAYS_INLINE SIMDuint32() noexcept : value( _mm_setzero_si128() ) {}
668  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
669  enum : size_t { size = 4UL };
670 #else
671  using IntrinsicType = ValueType;
672  BLAZE_ALWAYS_INLINE SIMDuint32() noexcept : value( 0 ) {}
673  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
674  enum : size_t { size = 1UL };
675 #endif
676 
677  BLAZE_ALWAYS_INLINE SIMDuint32( IntrinsicType v ) noexcept : value( v ) {}
678 
679  template< typename T >
680  BLAZE_ALWAYS_INLINE SIMDuint32( const SIMDi32<T>& v ) noexcept : value( (~v).value ) {}
681 
682  template< typename T >
683  BLAZE_ALWAYS_INLINE SIMDuint32& operator=( const SIMDi32<T>& v ) noexcept { value = (~v).value; return *this; }
684 
685  IntrinsicType value;
686 };
688 //*************************************************************************************************
689 
690 
691 
692 
693 //=================================================================================================
694 //
695 // 32-BIT INTEGRAL COMPLEX SIMD TYPES
696 //
697 //=================================================================================================
698 
699 //*************************************************************************************************
700 /*\class blaze::SIMDci32
701 // \brief Base class for all 32-bit integral complex SIMD data types.
702 // \ingroup simd
703 */
705 template< typename T > // Type of the SIMD element
706 struct SIMDci32
707  : public SIMDPack< T >
708 {};
710 //*************************************************************************************************
711 
712 
713 //*************************************************************************************************
719 struct SIMDcint32
720  : public SIMDci32< SIMDcint32 >
721 {
722  using This = SIMDcint32;
723  using BaseType = SIMDci32<This>;
724  using ValueType = complex<int32_t>;
725 
726 #if BLAZE_AVX512F_MODE || BLAZE_MIC_MODE
727  using IntrinsicType = __m512i;
728  BLAZE_ALWAYS_INLINE SIMDcint32() noexcept : value( _mm512_setzero_epi32() ) {}
729  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
730  enum : size_t { size = 8UL };
731 #elif BLAZE_AVX2_MODE
732  using IntrinsicType = __m256i;
733  BLAZE_ALWAYS_INLINE SIMDcint32() noexcept : value( _mm256_setzero_si256() ) {}
734  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
735  enum : size_t { size = 4UL };
736 #elif BLAZE_SSE2_MODE
737  using IntrinsicType = __m128i;
738  BLAZE_ALWAYS_INLINE SIMDcint32() noexcept : value( _mm_setzero_si128() ) {}
739  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
740  enum : size_t { size = 2UL };
741 #else
742  using IntrinsicType = ValueType;
743  BLAZE_ALWAYS_INLINE SIMDcint32() noexcept : value( 0, 0 ) {}
744  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
745  enum : size_t { size = 1UL };
746 #endif
747 
748  BLAZE_ALWAYS_INLINE SIMDcint32( IntrinsicType v ) noexcept : value( v ) {}
749 
750  template< typename T >
751  BLAZE_ALWAYS_INLINE SIMDcint32( const SIMDci32<T>& v ) noexcept : value( (~v).value ) {}
752 
753  template< typename T >
754  BLAZE_ALWAYS_INLINE SIMDcint32& operator=( const SIMDci32<T>& v ) noexcept { value = (~v).value; return *this; }
755 
756  IntrinsicType value;
757 };
759 //*************************************************************************************************
760 
761 
762 //*************************************************************************************************
768 struct SIMDcuint32
769  : public SIMDci32< SIMDcuint32 >
770 {
771  using This = SIMDcuint32;
772  using BaseType = SIMDci32<This>;
773  using ValueType = complex<uint32_t>;
774 
775 #if BLAZE_AVX512F_MODE || BLAZE_MIC_MODE
776  using IntrinsicType = __m512i;
777  BLAZE_ALWAYS_INLINE SIMDcuint32() noexcept : value( _mm512_setzero_epi32() ) {}
778  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
779  enum : size_t { size = 8UL };
780 #elif BLAZE_AVX2_MODE
781  using IntrinsicType = __m256i;
782  BLAZE_ALWAYS_INLINE SIMDcuint32() noexcept : value( _mm256_setzero_si256() ) {}
783  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
784  enum : size_t { size = 4UL };
785 #elif BLAZE_SSE2_MODE
786  using IntrinsicType = __m128i;
787  BLAZE_ALWAYS_INLINE SIMDcuint32() noexcept : value( _mm_setzero_si128() ) {}
788  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
789  enum : size_t { size = 2UL };
790 #else
791  using IntrinsicType = ValueType;
792  BLAZE_ALWAYS_INLINE SIMDcuint32() noexcept : value( 0, 0 ) {}
793  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
794  enum : size_t { size = 1UL };
795 #endif
796 
797  BLAZE_ALWAYS_INLINE SIMDcuint32( IntrinsicType v ) noexcept : value( v ) {}
798 
799  template< typename T >
800  BLAZE_ALWAYS_INLINE SIMDcuint32( const SIMDci32<T>& v ) noexcept : value( (~v).value ) {}
801 
802  template< typename T >
803  BLAZE_ALWAYS_INLINE SIMDcuint32& operator=( const SIMDci32<T>& v ) noexcept { value = (~v).value; return *this; }
804 
805  IntrinsicType value;
806 };
808 //*************************************************************************************************
809 
810 
811 
812 
813 //=================================================================================================
814 //
815 // 64-BIT INTEGRAL SIMD TYPES
816 //
817 //=================================================================================================
818 
819 //*************************************************************************************************
820 /*\class blaze::SIMDi64
821 // \brief Base class for all 64-bit integral SIMD data types.
822 // \ingroup simd
823 */
825 template< typename T > // Type of the SIMD element
826 struct SIMDi64
827  : public SIMDPack< T >
828 {};
830 //*************************************************************************************************
831 
832 
833 //*************************************************************************************************
839 struct SIMDint64
840  : public SIMDi64< SIMDint64 >
841 {
842  using This = SIMDint64;
843  using BaseType = SIMDi64<This>;
844  using ValueType = int64_t;
845 
846 #if BLAZE_AVX512F_MODE || BLAZE_MIC_MODE
847  using IntrinsicType = __m512i;
848  BLAZE_ALWAYS_INLINE SIMDint64() noexcept : value( _mm512_setzero_epi32() ) {}
849  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
850  enum : size_t { size = 8UL };
851 #elif BLAZE_AVX2_MODE
852  using IntrinsicType = __m256i;
853  BLAZE_ALWAYS_INLINE SIMDint64() noexcept : value( _mm256_setzero_si256() ) {}
854  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
855  enum : size_t { size = 4UL };
856 #elif BLAZE_SSE2_MODE
857  using IntrinsicType = __m128i;
858  BLAZE_ALWAYS_INLINE SIMDint64() noexcept : value( _mm_setzero_si128() ) {}
859  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
860  enum : size_t { size = 2UL };
861 #else
862  using IntrinsicType = ValueType;
863  BLAZE_ALWAYS_INLINE SIMDint64() noexcept : value( 0L ) {}
864  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
865  enum : size_t { size = 1UL };
866 #endif
867 
868  BLAZE_ALWAYS_INLINE SIMDint64( IntrinsicType v ) noexcept : value( v ) {}
869 
870  template< typename T >
871  BLAZE_ALWAYS_INLINE SIMDint64( const SIMDi64<T>& v ) noexcept : value( (~v).value ) {}
872 
873  template< typename T >
874  BLAZE_ALWAYS_INLINE SIMDint64& operator=( const SIMDi64<T>& v ) noexcept { value = (~v).value; return *this; }
875 
876  IntrinsicType value;
877 };
879 //*************************************************************************************************
880 
881 
882 //*************************************************************************************************
888 struct SIMDuint64
889  : public SIMDi64< SIMDuint64 >
890 {
891  using This = SIMDuint64;
892  using BaseType = SIMDi64<This>;
893  using ValueType = uint64_t;
894 
895 #if BLAZE_AVX512F_MODE || BLAZE_MIC_MODE
896  using IntrinsicType = __m512i;
897  BLAZE_ALWAYS_INLINE SIMDuint64() noexcept : value( _mm512_setzero_epi32() ) {}
898  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
899  enum : size_t { size = 8UL };
900 #elif BLAZE_AVX2_MODE
901  using IntrinsicType = __m256i;
902  BLAZE_ALWAYS_INLINE SIMDuint64() noexcept : value( _mm256_setzero_si256() ) {}
903  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
904  enum : size_t { size = 4UL };
905 #elif BLAZE_SSE2_MODE
906  using IntrinsicType = __m128i;
907  BLAZE_ALWAYS_INLINE SIMDuint64() noexcept : value( _mm_setzero_si128() ) {}
908  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
909  enum : size_t { size = 2UL };
910 #else
911  using IntrinsicType = ValueType;
912  BLAZE_ALWAYS_INLINE SIMDuint64() noexcept : value( 0L ) {}
913  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
914  enum : size_t { size = 1UL };
915 #endif
916 
917  BLAZE_ALWAYS_INLINE SIMDuint64( IntrinsicType v ) noexcept : value( v ) {}
918 
919  template< typename T >
920  BLAZE_ALWAYS_INLINE SIMDuint64( const SIMDi64<T>& v ) noexcept : value( (~v).value ) {}
921 
922  template< typename T >
923  BLAZE_ALWAYS_INLINE SIMDuint64& operator=( const SIMDi64<T>& v ) noexcept { value = (~v).value; return *this; }
924 
925  IntrinsicType value;
926 };
928 //*************************************************************************************************
929 
930 
931 
932 
933 //=================================================================================================
934 //
935 // 64-BIT INTEGRAL COMPLEX SIMD TYPES
936 //
937 //=================================================================================================
938 
939 //*************************************************************************************************
940 /*\class blaze::SIMDci64
941 // \brief Base class for all 64-bit integral complex SIMD data types.
942 // \ingroup simd
943 */
945 template< typename T > // Type of the SIMD element
946 struct SIMDci64
947  : public SIMDPack< T >
948 {};
950 //*************************************************************************************************
951 
952 
953 //*************************************************************************************************
959 struct SIMDcint64
960  : public SIMDci64< SIMDcint64 >
961 {
962  using This = SIMDcint64;
963  using BaseType = SIMDci64<This>;
964  using ValueType = complex<int64_t>;
965 
966 #if BLAZE_AVX512F_MODE || BLAZE_MIC_MODE
967  using IntrinsicType = __m512i;
968  BLAZE_ALWAYS_INLINE SIMDcint64() noexcept : value( _mm512_setzero_epi32() ) {}
969  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
970  enum : size_t { size = 4UL };
971 #elif BLAZE_AVX2_MODE
972  using IntrinsicType = __m256i;
973  BLAZE_ALWAYS_INLINE SIMDcint64() noexcept : value( _mm256_setzero_si256() ) {}
974  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
975  enum : size_t { size = 2UL };
976 #elif BLAZE_SSE2_MODE
977  using IntrinsicType = __m128i;
978  BLAZE_ALWAYS_INLINE SIMDcint64() noexcept : value( _mm_setzero_si128() ) {}
979  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
980  enum : size_t { size = 1UL };
981 #else
982  using IntrinsicType = ValueType;
983  BLAZE_ALWAYS_INLINE SIMDcint64() noexcept : value( 0L, 0L ) {}
984  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
985  enum : size_t { size = 1UL };
986 #endif
987 
988  BLAZE_ALWAYS_INLINE SIMDcint64( IntrinsicType v ) noexcept : value( v ) {}
989 
990  template< typename T >
991  BLAZE_ALWAYS_INLINE SIMDcint64( const SIMDci64<T>& v ) noexcept : value( (~v).value ) {}
992 
993  template< typename T >
994  BLAZE_ALWAYS_INLINE SIMDcint64& operator=( const SIMDci64<T>& v ) noexcept { value = (~v).value; return *this; }
995 
996  IntrinsicType value;
997 };
999 //*************************************************************************************************
1000 
1001 
1002 //*************************************************************************************************
1008 struct SIMDcuint64
1009  : public SIMDci64< SIMDcuint64 >
1010 {
1011  using This = SIMDcuint64;
1012  using BaseType = SIMDci64<This>;
1013  using ValueType = complex<uint64_t>;
1014 
1015 #if BLAZE_AVX512F_MODE || BLAZE_MIC_MODE
1016  using IntrinsicType = __m512i;
1017  BLAZE_ALWAYS_INLINE SIMDcuint64() noexcept : value( _mm512_setzero_epi32() ) {}
1018  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
1019  enum : size_t { size = 4UL };
1020 #elif BLAZE_AVX2_MODE
1021  using IntrinsicType = __m256i;
1022  BLAZE_ALWAYS_INLINE SIMDcuint64() noexcept : value( _mm256_setzero_si256() ) {}
1023  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
1024  enum : size_t { size = 2UL };
1025 #elif BLAZE_SSE2_MODE
1026  using IntrinsicType = __m128i;
1027  BLAZE_ALWAYS_INLINE SIMDcuint64() noexcept : value( _mm_setzero_si128() ) {}
1028  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
1029  enum : size_t { size = 1UL };
1030 #else
1031  using IntrinsicType = ValueType;
1032  BLAZE_ALWAYS_INLINE SIMDcuint64() noexcept : value( 0L, 0L ) {}
1033  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
1034  enum : size_t { size = 1UL };
1035 #endif
1036 
1037  BLAZE_ALWAYS_INLINE SIMDcuint64( IntrinsicType v ) noexcept : value( v ) {}
1038 
1039  template< typename T >
1040  BLAZE_ALWAYS_INLINE SIMDcuint64( const SIMDci64<T>& v ) noexcept : value( (~v).value ) {}
1041 
1042  template< typename T >
1043  BLAZE_ALWAYS_INLINE SIMDcuint64& operator=( const SIMDci64<T>& v ) noexcept { value = (~v).value; return *this; }
1044 
1045  IntrinsicType value;
1046 };
1048 //*************************************************************************************************
1049 
1050 
1051 
1052 
1053 //=================================================================================================
1054 //
1055 // SINGLE PRECISION FLOATING POINT SIMD TYPES
1056 //
1057 //=================================================================================================
1058 
1059 //*************************************************************************************************
1060 /*\class blaze::SIMDf32
1061 // \brief Base class for all single precision floating point SIMD data types.
1062 // \ingroup simd
1063 */
1065 template< typename T > // Type of the SIMD element
1066 struct SIMDf32
1067  : public SIMDPack< T >
1068 {};
1070 //*************************************************************************************************
1071 
1072 
1073 //*************************************************************************************************
1079 struct SIMDfloat
1080  : public SIMDf32< SIMDfloat >
1081 {
1082  using This = SIMDfloat;
1083  using BaseType = SIMDf32<This>;
1084  using ValueType = float;
1085 
1086 #if BLAZE_AVX512F_MODE || BLAZE_MIC_MODE
1087  using IntrinsicType = __m512;
1088  BLAZE_ALWAYS_INLINE SIMDfloat() noexcept : value( _mm512_setzero_ps() ) {}
1089  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
1090  enum : size_t { size = 16UL };
1091 #elif BLAZE_AVX_MODE
1092  using IntrinsicType = __m256;
1093  BLAZE_ALWAYS_INLINE SIMDfloat() noexcept : value( _mm256_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_SSE_MODE
1097  using IntrinsicType = __m128;
1098  BLAZE_ALWAYS_INLINE SIMDfloat() noexcept : value( _mm_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 #else
1102  using IntrinsicType = ValueType;
1103  BLAZE_ALWAYS_INLINE SIMDfloat() noexcept : value( 0.0F ) {}
1104  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
1105  enum : size_t { size = 1UL };
1106 #endif
1107 
1108  BLAZE_ALWAYS_INLINE SIMDfloat( IntrinsicType v ) noexcept : value( v ) {}
1109 
1110  template< typename T >
1111  BLAZE_ALWAYS_INLINE SIMDfloat( const SIMDf32<T>& v ) noexcept : value( (~v).eval().value ) {}
1112 
1113  template< typename T >
1114  BLAZE_ALWAYS_INLINE SIMDfloat& operator=( const SIMDf32<T>& v ) noexcept { value = (~v).eval().value; return *this; }
1115 
1116  BLAZE_ALWAYS_INLINE const This& eval() const { return *this; }
1117 
1118  IntrinsicType value;
1119 };
1121 //*************************************************************************************************
1122 
1123 
1124 
1125 
1126 //=================================================================================================
1127 //
1128 // SINGLE PRECISION FLOATING POINT COMPLEX SIMD TYPES
1129 //
1130 //=================================================================================================
1131 
1132 //*************************************************************************************************
1133 /*\class blaze::SIMDcf32
1134 // \brief Base class for all single precision floating point complex SIMD data types.
1135 // \ingroup simd
1136 */
1138 template< typename T > // Type of the SIMD element
1139 struct SIMDcf32
1140  : public SIMDPack< T >
1141 {};
1143 //*************************************************************************************************
1144 
1145 
1146 //*************************************************************************************************
1152 struct SIMDcfloat
1153  : public SIMDcf32< SIMDcfloat >
1154 {
1155  using This = SIMDcfloat;
1156  using BaseType = SIMDcf32<This>;
1157  using ValueType = complex<float>;
1158 
1159 #if BLAZE_AVX512F_MODE || BLAZE_MIC_MODE
1160  using IntrinsicType = __m512;
1161  BLAZE_ALWAYS_INLINE SIMDcfloat() noexcept : value( _mm512_setzero_ps() ) {}
1162  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
1163  enum : size_t { size = 8UL };
1164 #elif BLAZE_AVX_MODE
1165  using IntrinsicType = __m256;
1166  BLAZE_ALWAYS_INLINE SIMDcfloat() noexcept : value( _mm256_setzero_ps() ) {}
1167  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
1168  enum : size_t { size = 4UL };
1169 #elif BLAZE_SSE_MODE
1170  using IntrinsicType = __m128;
1171  BLAZE_ALWAYS_INLINE SIMDcfloat() noexcept : value( _mm_setzero_ps() ) {}
1172  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
1173  enum : size_t { size = 2UL };
1174 #else
1175  using IntrinsicType = ValueType;
1176  BLAZE_ALWAYS_INLINE SIMDcfloat() noexcept : value( 0.0F, 0.0F ) {}
1177  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
1178  enum : size_t { size = 1UL };
1179 #endif
1180 
1181  BLAZE_ALWAYS_INLINE SIMDcfloat( IntrinsicType v ) noexcept : value( v ) {}
1182 
1183  template< typename T >
1184  BLAZE_ALWAYS_INLINE SIMDcfloat( const SIMDcf32<T>& v ) noexcept : value( (~v).value ) {}
1185 
1186  template< typename T >
1187  BLAZE_ALWAYS_INLINE SIMDcfloat& operator=( const SIMDcf32<T>& v ) noexcept { value = (~v).value; return *this; }
1188 
1189  IntrinsicType value;
1190 };
1192 //*************************************************************************************************
1193 
1194 
1195 
1196 
1197 //=================================================================================================
1198 //
1199 // DOUBLE PRECISION FLOATING POINT SIMD TYPES
1200 //
1201 //=================================================================================================
1202 
1203 //*************************************************************************************************
1204 /*\class blaze::SIMDf64
1205 // \brief Base class for all double precision floating point SIMD data types.
1206 // \ingroup simd
1207 */
1209 template< typename T > // Type of the SIMD element
1210 struct SIMDf64
1211  : public SIMDPack< T >
1212 {};
1214 //*************************************************************************************************
1215 
1216 
1217 //*************************************************************************************************
1223 struct SIMDdouble
1224  : public SIMDf64< SIMDdouble >
1225 {
1226  using This = SIMDdouble;
1227  using BaseType = SIMDf64<This>;
1228  using ValueType = double;
1229 
1230 #if BLAZE_AVX512F_MODE || BLAZE_MIC_MODE
1231  using IntrinsicType = __m512d;
1232  BLAZE_ALWAYS_INLINE SIMDdouble() noexcept : value( _mm512_setzero_pd() ) {}
1233  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
1234  enum : size_t { size = 8UL };
1235 #elif BLAZE_AVX_MODE
1236  using IntrinsicType = __m256d;
1237  BLAZE_ALWAYS_INLINE SIMDdouble() noexcept : value( _mm256_setzero_pd() ) {}
1238  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
1239  enum : size_t { size = 4UL };
1240 #elif BLAZE_SSE2_MODE
1241  using IntrinsicType = __m128d;
1242  BLAZE_ALWAYS_INLINE SIMDdouble() noexcept : value( _mm_setzero_pd() ) {}
1243  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
1244  enum : size_t { size = 2UL };
1245 #else
1246  using IntrinsicType = ValueType;
1247  BLAZE_ALWAYS_INLINE SIMDdouble() noexcept : value( 0.0 ) {}
1248  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
1249  enum : size_t { size = 1UL };
1250 #endif
1251 
1252  BLAZE_ALWAYS_INLINE SIMDdouble( IntrinsicType v ) noexcept : value( v ) {}
1253 
1254  template< typename T >
1255  BLAZE_ALWAYS_INLINE SIMDdouble( const SIMDf64<T>& v ) noexcept : value( (~v).eval().value ) {}
1256 
1257  template< typename T >
1258  BLAZE_ALWAYS_INLINE SIMDdouble& operator=( const SIMDf64<T>& v ) noexcept { value = (~v).eval().value; return *this; }
1259 
1260  BLAZE_ALWAYS_INLINE const This& eval() const { return *this; }
1261 
1262  IntrinsicType value;
1263 };
1265 //*************************************************************************************************
1266 
1267 
1268 
1269 
1270 //=================================================================================================
1271 //
1272 // DOUBLE PRECISION FLOATING POINT COMPLEX SIMD TYPES
1273 //
1274 //=================================================================================================
1275 
1276 //*************************************************************************************************
1277 /*\class blaze::SIMDcf64
1278 // \brief Base class for all double precision floating point complex SIMD data types.
1279 // \ingroup simd
1280 */
1282 template< typename T > // Type of the SIMD element
1283 struct SIMDcf64
1284  : public SIMDPack< T >
1285 {};
1287 //*************************************************************************************************
1288 
1289 
1290 //*************************************************************************************************
1296 struct SIMDcdouble
1297  : public SIMDcf64< SIMDcdouble >
1298 {
1299  using This = SIMDcdouble;
1300  using BaseType = SIMDcf64<This>;
1301  using ValueType = complex<double>;
1302 
1303 #if BLAZE_AVX512F_MODE || BLAZE_MIC_MODE
1304  using IntrinsicType = __m512d;
1305  BLAZE_ALWAYS_INLINE SIMDcdouble() noexcept : value( _mm512_setzero_pd() ) {}
1306  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
1307  enum : size_t { size = 4UL };
1308 #elif BLAZE_AVX_MODE
1309  using IntrinsicType = __m256d;
1310  BLAZE_ALWAYS_INLINE SIMDcdouble() noexcept : value( _mm256_setzero_pd() ) {}
1311  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
1312  enum : size_t { size = 2UL };
1313 #elif BLAZE_SSE2_MODE
1314  using IntrinsicType = __m128d;
1315  BLAZE_ALWAYS_INLINE SIMDcdouble() noexcept : value( _mm_setzero_pd() ) {}
1316  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t i ) const noexcept { return reinterpret_cast<const ValueType*>( &value )[i]; }
1317  enum : size_t { size = 1UL };
1318 #else
1319  using IntrinsicType = ValueType;
1320  BLAZE_ALWAYS_INLINE SIMDcdouble() noexcept : value( 0.0, 0.0 ) {}
1321  BLAZE_ALWAYS_INLINE ValueType operator[]( size_t /*i*/ ) const noexcept { return value; }
1322  enum : size_t { size = 1UL };
1323 #endif
1324 
1325  BLAZE_ALWAYS_INLINE SIMDcdouble( IntrinsicType v ) noexcept : value( v ) {}
1326 
1327  template< typename T >
1328  BLAZE_ALWAYS_INLINE SIMDcdouble( const SIMDcf64<T>& v ) noexcept : value( (~v).value ) {}
1329 
1330  template< typename T >
1331  BLAZE_ALWAYS_INLINE SIMDcdouble& operator=( const SIMDcf64<T>& v ) noexcept { value = (~v).value; return *this; }
1332 
1333  IntrinsicType value;
1334 };
1336 //*************************************************************************************************
1337 
1338 
1339 
1340 
1341 //=================================================================================================
1342 //
1343 // SIMD OPERATORS
1344 //
1345 //=================================================================================================
1346 
1347 //*************************************************************************************************
1355 template< typename T1 // Type of the left-hand side SIMD operand
1356  , typename T2 > // Type of the right-hand side SIMD operand
1358 {
1359  (~lhs) = (~lhs) + (~rhs);
1360  return ~lhs;
1361 }
1362 //*************************************************************************************************
1363 
1364 
1365 //*************************************************************************************************
1373 template< typename T1 // Type of the left-hand side SIMD operand
1374  , typename T2 > // Type of the right-hand side SIMD operand
1376 {
1377  (~lhs) = (~lhs) - (~rhs);
1378  return ~lhs;
1379 }
1380 //*************************************************************************************************
1381 
1382 
1383 //*************************************************************************************************
1391 template< typename T1 // Type of the left-hand side SIMD operand
1392  , typename T2 > // Type of the right-hand side SIMD operand
1394 {
1395  (~lhs) = (~lhs) * (~rhs);
1396  return ~lhs;
1397 }
1398 //*************************************************************************************************
1399 
1400 
1401 //*************************************************************************************************
1409 template< typename T1 // Type of the left-hand side SIMD operand
1410  , typename T2 > // Type of the right-hand side SIMD operand
1412 {
1413  (~lhs) = (~lhs) / (~rhs);
1414  return ~lhs;
1415 }
1416 //*************************************************************************************************
1417 
1418 } // namespace blaze
1419 
1420 #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:265
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:1411
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3076
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:1393
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
SparseMatrix< This, true > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3077
Base class for all SIMD data types.The SIMDPack class template is a base class for all SIMD data type...
Definition: SIMDPack.h:63
decltype(auto) eval(const DenseMatrix< MT, SO > &dm)
Forces the evaluation of the given dense matrix expression dm.
Definition: DMatEvalExpr.h:797
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:1357
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:1375
System settings for the inline keywords.
Header file for the TrueType type/value trait base class.