Blaze 3.9
Loading...
Searching...
No Matches
HasSIMDMult.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_TYPETRAITS_HASSIMDMULT_H_
36#define _BLAZE_MATH_TYPETRAITS_HASSIMDMULT_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
44#include <blaze/util/Complex.h>
45#include <blaze/util/EnableIf.h>
50
51
52namespace blaze {
53
54//=================================================================================================
55//
56// CLASS DEFINITION
57//
58//=================================================================================================
59
60//*************************************************************************************************
65template< typename T1 // Type of the left-hand side operand
66 , typename T2 // Type of the right-hand side operand
67 , typename = void > // Restricting condition
68struct HasSIMDMultHelper
69 : public FalseType
70{};
72//*************************************************************************************************
73
74
75//*************************************************************************************************
77template< typename T1, typename T2 >
78struct HasSIMDMultHelper< T1, T2, EnableIf_t< IsNumeric_v<T1> && IsIntegral_v<T1> &&
80 sizeof(T1) == sizeof(T2) > >
81 : public BoolConstant< ( bool( BLAZE_SSE2_MODE ) && sizeof(T1) == 2UL ) ||
82 ( bool( BLAZE_SSE4_MODE ) && sizeof(T1) >= 2UL && sizeof(T1) <= 4UL ) ||
83 ( bool( BLAZE_AVX2_MODE ) && sizeof(T1) >= 2UL && sizeof(T1) <= 4UL ) ||
84 ( bool( BLAZE_MIC_MODE ) && sizeof(T1) == 4UL ) ||
85 ( bool( BLAZE_AVX512BW_MODE ) && sizeof(T1) == 2UL ) ||
86 ( bool( BLAZE_AVX512F_MODE ) && sizeof(T1) == 4UL ) ||
87 ( bool( BLAZE_AVX512DQ_MODE ) && sizeof(T1) == 8UL ) >
88{};
89
90template< typename T >
91struct HasSIMDMultHelper< complex<T>, complex<T>, EnableIf_t< IsNumeric_v<T> && IsIntegral_v<T> > >
92 : public BoolConstant< ( bool( BLAZE_SSE2_MODE ) && sizeof(T) == 2UL ) ||
93 ( bool( BLAZE_SSE4_MODE ) && sizeof(T) >= 2UL && sizeof(T) <= 4UL ) ||
94 ( bool( BLAZE_AVX2_MODE ) && sizeof(T) >= 2UL && sizeof(T) <= 4UL ) ||
95 ( bool( BLAZE_AVX512BW_MODE ) && sizeof(T) == 2UL ) ||
96 ( bool( BLAZE_AVX512F_MODE ) && sizeof(T) == 4UL ) ||
97 ( bool( BLAZE_AVX512DQ_MODE ) && sizeof(T) == 8UL ) >
98{};
100//*************************************************************************************************
101
102
103//*************************************************************************************************
105template<>
106struct HasSIMDMultHelper< float, float >
107 : public BoolConstant< bool( BLAZE_SSE_MODE ) ||
108 bool( BLAZE_AVX_MODE ) ||
109 bool( BLAZE_MIC_MODE ) ||
110 bool( BLAZE_AVX512F_MODE ) >
111{};
112
113template<>
114struct HasSIMDMultHelper< complex<float>, complex<float> >
115 : public BoolConstant< ( bool( BLAZE_SSE3_MODE ) && !bool( BLAZE_MIC_MODE ) ) ||
116 ( bool( BLAZE_AVX_MODE ) && !bool( BLAZE_MIC_MODE ) ) ||
117 ( bool( BLAZE_AVX512F_MODE ) && !bool( BLAZE_MIC_MODE ) ) >
118{};
120//*************************************************************************************************
121
122
123//*************************************************************************************************
125template<>
126struct HasSIMDMultHelper< double, double >
127 : public BoolConstant< bool( BLAZE_SSE2_MODE ) ||
128 bool( BLAZE_AVX_MODE ) ||
129 bool( BLAZE_MIC_MODE ) ||
130 bool( BLAZE_AVX512F_MODE ) >
131{};
132
133template<>
134struct HasSIMDMultHelper< complex<double>, complex<double> >
135 : public BoolConstant< ( bool( BLAZE_SSE3_MODE ) && !bool( BLAZE_MIC_MODE ) ) ||
136 ( bool( BLAZE_AVX_MODE ) && !bool( BLAZE_MIC_MODE ) ) ||
137 ( bool( BLAZE_AVX512F_MODE ) && !bool( BLAZE_MIC_MODE ) ) >
138{};
140//*************************************************************************************************
141
142
143//*************************************************************************************************
164template< typename T1 // Type of the left-hand side operand
165 , typename T2 // Type of the right-hand side operand
166 , typename = void > // Restricting condition
168 : public BoolConstant< HasSIMDMultHelper< RemoveCVRef_t<T1>, RemoveCVRef_t<T2> >::value >
169{};
170//*************************************************************************************************
171
172
173//*************************************************************************************************
186template< typename T1 // Type of the left-hand side operand
187 , typename T2 > // Type of the right-hand side operand
189//*************************************************************************************************
190
191} // namespace blaze
192
193#endif
Header file for the complex data type.
Header file for the EnableIf class template.
Header file for the IntegralConstant class template.
Header file for the IsIntegral type trait.
Header file for the IsNumeric type trait.
Header file for the RemoveCVRef type trait.
constexpr bool HasSIMDMult_v
Auxiliary variable template for the HasSIMDMult type trait.
Definition HasSIMDMult.h:188
#define BLAZE_AVX512F_MODE
Compilation switch for the AVX512F mode.
Definition Vectorization.h:246
#define BLAZE_SSE4_MODE
Compilation switch for the SSE4 mode.
Definition Vectorization.h:194
#define BLAZE_AVX512BW_MODE
Compilation switch for the AVX512BW mode.
Definition Vectorization.h:264
#define BLAZE_AVX2_MODE
Compilation switch for the AVX2 mode.
Definition Vectorization.h:228
#define BLAZE_MIC_MODE
Compilation switch for the MIC mode.
Definition Vectorization.h:299
#define BLAZE_AVX512DQ_MODE
Compilation switch for the AVX512DQ mode.
Definition Vectorization.h:282
#define BLAZE_SSE2_MODE
Compilation switch for the SSE2 mode.
Definition Vectorization.h:143
constexpr bool IsNumeric_v
Auxiliary variable template for the IsNumeric type trait.
Definition IsNumeric.h:132
constexpr bool IsIntegral_v
Auxiliary variable template for the IsIntegral type trait.
Definition IsIntegral.h:95
BoolConstant< false > FalseType
Type/value traits base class.
Definition IntegralConstant.h:121
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.
Definition EnableIf.h:138
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.
Definition IntegralConstant.h:110
Availability of a SIMD multiplication for the given data types.
Definition HasSIMDMult.h:169
System settings for the SSE mode.