HasSIMDAdd.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_TYPETRAITS_HASSIMDADD_H_
36 #define _BLAZE_MATH_TYPETRAITS_HASSIMDADD_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
44 #include <blaze/util/Complex.h>
45 #include <blaze/util/EnableIf.h>
47 #include <blaze/util/mpl/And.h>
51 
52 
53 namespace blaze {
54 
55 //=================================================================================================
56 //
57 // CLASS DEFINITION
58 //
59 //=================================================================================================
60 
61 //*************************************************************************************************
63 template< typename T1 // Type of the left-hand side operand
64  , typename T2 // Type of the right-hand side operand
65  , typename = void > // Restricting condition
66 struct HasSIMDAddHelper
67 {
68  enum : bool { value = false };
69 };
71 //*************************************************************************************************
72 
73 
74 //*************************************************************************************************
76 template< typename T1, typename T2 >
77 struct HasSIMDAddHelper< T1, T2, EnableIf_< And< IsNumeric<T1>, IsIntegral<T1>
78  , IsNumeric<T2>, IsIntegral<T2>
79  , Bool< sizeof(T1) == sizeof(T2) > > > >
80 {
81  enum : bool { value = ( bool( BLAZE_SSE2_MODE ) ) ||
82  ( bool( BLAZE_AVX2_MODE ) ) ||
83  ( bool( BLAZE_MIC_MODE ) && sizeof(T1) >= 4UL ) ||
84  ( bool( BLAZE_AVX512BW_MODE ) && sizeof(T1) <= 2UL ) ||
85  ( bool( BLAZE_AVX512F_MODE ) && sizeof(T1) >= 4UL ) };
86 };
87 
88 template< typename T >
89 struct HasSIMDAddHelper< complex<T>, complex<T>, EnableIf_< And< IsNumeric<T>, IsIntegral<T> > > >
90 {
91  enum : bool { value = ( bool( BLAZE_SSE2_MODE ) ) ||
92  ( bool( BLAZE_AVX2_MODE ) ) ||
93  ( bool( BLAZE_MIC_MODE ) && sizeof(T) >= 4UL ) ||
94  ( bool( BLAZE_AVX512BW_MODE ) && sizeof(T) <= 2UL ) ||
95  ( bool( BLAZE_AVX512F_MODE ) && sizeof(T) >= 4UL ) };
96 };
98 //*************************************************************************************************
99 
100 
101 //*************************************************************************************************
103 template<>
104 struct HasSIMDAddHelper< float, float >
105 {
106  enum : bool { value = bool( BLAZE_SSE_MODE ) ||
107  bool( BLAZE_AVX_MODE ) ||
108  bool( BLAZE_MIC_MODE ) ||
109  bool( BLAZE_AVX512F_MODE ) };
110 };
111 
112 template<>
113 struct HasSIMDAddHelper< complex<float>, complex<float> >
114 {
115  enum : bool { value = bool( BLAZE_SSE_MODE ) ||
116  bool( BLAZE_AVX_MODE ) ||
117  bool( BLAZE_MIC_MODE ) ||
118  bool( BLAZE_AVX512F_MODE ) };
119 };
121 //*************************************************************************************************
122 
123 
124 //*************************************************************************************************
126 template<>
127 struct HasSIMDAddHelper< double, double >
128 {
129  enum : bool { value = bool( BLAZE_SSE2_MODE ) ||
130  bool( BLAZE_AVX_MODE ) ||
131  bool( BLAZE_MIC_MODE ) ||
132  bool( BLAZE_AVX512F_MODE ) };
133 };
134 
135 template<>
136 struct HasSIMDAddHelper< complex<double>, complex<double> >
137 {
138  enum : bool { value = bool( BLAZE_SSE2_MODE ) ||
139  bool( BLAZE_AVX_MODE ) ||
140  bool( BLAZE_MIC_MODE ) ||
141  bool( BLAZE_AVX512F_MODE ) };
142 };
144 //*************************************************************************************************
145 
146 
147 //*************************************************************************************************
168 template< typename T1 // Type of the left-hand side operand
169  , typename T2 // Type of the right-hand side operand
170  , typename = void > // Restricting condition
172  : public BoolConstant< HasSIMDAddHelper< Decay_<T1>, Decay_<T2> >::value >
173 {};
174 //*************************************************************************************************
175 
176 } // namespace blaze
177 
178 #endif
#define BLAZE_AVX512F_MODE
Compilation switch for the AVX512F mode.This compilation switch enables/disables the AVX512F mode...
Definition: Vectorization.h:246
Generic wrapper for a compile time constant integral value.The IntegralConstant class template repres...
Definition: IntegralConstant.h:71
#define BLAZE_MIC_MODE
Compilation switch for the MIC mode.This compilation switch enables/disables the MIC mode...
Definition: Vectorization.h:299
#define BLAZE_AVX512BW_MODE
Compilation switch for the AVX512BW mode.This compilation switch enables/disables the AVX512BW mode...
Definition: Vectorization.h:264
Header file for the IsIntegral type trait.
Header file for the And class template.
Availability of a SIMD addition for the given data types.Depending on the available instruction set (...
Definition: HasSIMDAdd.h:171
#define BLAZE_AVX2_MODE
Compilation switch for the AVX2 mode.This compilation switch enables/disables the AVX2 mode...
Definition: Vectorization.h:228
Header file for the Decay type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
#define BLAZE_SSE_MODE
Compilation switch for the SSE mode.This compilation switch enables/disables the SSE mode...
Definition: Vectorization.h:126
Header file for the EnableIf class template.
Header file for the IsNumeric type trait.
#define BLAZE_AVX_MODE
Compilation switch for the AVX mode.This compilation switch enables/disables the AVX mode...
Definition: Vectorization.h:211
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:224
Header file for the IntegralConstant class template.
System settings for the SSE mode.
Header file for the complex data type.
#define BLAZE_SSE2_MODE
Compilation switch for the SSE2 mode.This compilation switch enables/disables the SSE2 mode...
Definition: Vectorization.h:143