HasSIMDMax.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_TYPETRAITS_HASSIMDMAX_H_
36 #define _BLAZE_MATH_TYPETRAITS_HASSIMDMAX_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>
54 
55 
56 namespace blaze {
57 
58 //=================================================================================================
59 //
60 // CLASS DEFINITION
61 //
62 //=================================================================================================
63 
64 //*************************************************************************************************
66 template< typename T1 // Type of the left-hand side operand
67  , typename T2 // Type of the right-hand side operand
68  , typename = void > // Restricting condition
69 struct HasSIMDMaxHelper
70 {
71  enum : bool { value = false };
72 };
74 //*************************************************************************************************
75 
76 
77 //*************************************************************************************************
79 template< typename T >
80 struct HasSIMDMaxHelper< T, T, EnableIf_< And< IsNumeric<T>, IsIntegral<T>, Has1Byte<T> > > >
81 {
82  enum : bool { value = ( bool( BLAZE_SSE2_MODE ) && IsUnsigned<T>::value ) ||
83  ( bool( BLAZE_SSE4_MODE ) && IsSigned<T>::value ) ||
84  bool( BLAZE_AVX2_MODE ) ||
85  bool( BLAZE_AVX512BW_MODE ) };
86 };
88 //*************************************************************************************************
89 
90 
91 //*************************************************************************************************
93 template< typename T >
94 struct HasSIMDMaxHelper< T, T, EnableIf_< And< IsNumeric<T>, IsIntegral<T>, Has2Bytes<T> > > >
95 {
96  enum : bool { value = ( bool( BLAZE_SSE2_MODE ) && IsSigned<T>::value ) ||
97  ( bool( BLAZE_SSE4_MODE ) && IsUnsigned<T>::value ) ||
98  bool( BLAZE_AVX2_MODE ) ||
99  bool( BLAZE_AVX512BW_MODE ) };
100 };
102 //*************************************************************************************************
103 
104 
105 //*************************************************************************************************
107 template< typename T >
108 struct HasSIMDMaxHelper< T, T, EnableIf_< And< IsNumeric<T>, IsIntegral<T>, Has4Bytes<T> > > >
109 {
110  enum : bool { value = bool( BLAZE_SSE4_MODE ) ||
111  bool( BLAZE_AVX2_MODE ) ||
112  bool( BLAZE_MIC_MODE ) ||
113  bool( BLAZE_AVX512F_MODE ) };
114 };
116 //*************************************************************************************************
117 
118 
119 //*************************************************************************************************
121 template<>
122 struct HasSIMDMaxHelper< float, float >
123 {
124  enum : bool { value = bool( BLAZE_SSE_MODE ) ||
125  bool( BLAZE_AVX_MODE ) ||
126  bool( BLAZE_MIC_MODE ) ||
127  bool( BLAZE_AVX512F_MODE ) };
128 };
130 //*************************************************************************************************
131 
132 
133 //*************************************************************************************************
135 template<>
136 struct HasSIMDMaxHelper< double, 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< HasSIMDMaxHelper< 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.
#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.
Availability of a SIMD max operation for the given data types.Depending on the available instruction ...
Definition: HasSIMDMax.h:171
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#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_SSE4_MODE
Compilation switch for the SSE4 mode.This compilation switch enables/disables the SSE4 mode...
Definition: Vectorization.h:194
Header file for the HasSize type trait.
#define BLAZE_AVX_MODE
Compilation switch for the AVX mode.This compilation switch enables/disables the AVX mode...
Definition: Vectorization.h:211
Header file for the IsSigned type trait.
Header file for the IsUnsigned type trait.
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