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>
46 #include <blaze/util/FalseType.h>
54 
55 
56 namespace blaze {
57 
58 //=================================================================================================
59 //
60 // CLASS DEFINITION
61 //
62 //=================================================================================================
63 
64 //*************************************************************************************************
69 template< typename T1 // Type of the left-hand side operand
70  , typename T2 // Type of the right-hand side operand
71  , typename = void > // Restricting condition
72 struct HasSIMDMaxHelper
73  : public FalseType
74 {};
76 //*************************************************************************************************
77 
78 
79 //*************************************************************************************************
81 template< typename T >
82 struct HasSIMDMaxHelper< T, T, EnableIf_t< IsNumeric_v<T> && IsIntegral_v<T> && Has1Byte_v<T> > >
83  : public BoolConstant< ( bool( BLAZE_SSE2_MODE ) && IsUnsigned_v<T> ) ||
84  ( bool( BLAZE_SSE4_MODE ) && IsSigned_v<T> ) ||
85  bool( BLAZE_AVX2_MODE ) ||
86  bool( BLAZE_AVX512BW_MODE ) >
87 {};
89 //*************************************************************************************************
90 
91 
92 //*************************************************************************************************
94 template< typename T >
95 struct HasSIMDMaxHelper< T, T, EnableIf_t< IsNumeric_v<T> && IsIntegral_v<T> && Has2Bytes_v<T> > >
96  : public BoolConstant< ( bool( BLAZE_SSE2_MODE ) && IsSigned_v<T> ) ||
97  ( bool( BLAZE_SSE4_MODE ) && IsUnsigned_v<T> ) ||
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_t< IsNumeric_v<T> && IsIntegral_v<T> && Has4Bytes_v<T> > >
109  : public BoolConstant< bool( BLAZE_SSE4_MODE ) ||
110  bool( BLAZE_AVX2_MODE ) ||
111  bool( BLAZE_MIC_MODE ) ||
112  bool( BLAZE_AVX512F_MODE ) >
113 {};
115 //*************************************************************************************************
116 
117 
118 //*************************************************************************************************
120 template<>
121 struct HasSIMDMaxHelper< float, float >
122  : public BoolConstant< bool( BLAZE_SSE_MODE ) ||
123  bool( BLAZE_AVX_MODE ) ||
124  bool( BLAZE_MIC_MODE ) ||
125  bool( BLAZE_AVX512F_MODE ) >
126 {};
128 //*************************************************************************************************
129 
130 
131 //*************************************************************************************************
133 template<>
134 struct HasSIMDMaxHelper< double, double >
135  : public BoolConstant< bool( BLAZE_SSE2_MODE ) ||
136  bool( BLAZE_AVX_MODE ) ||
137  bool( BLAZE_MIC_MODE ) ||
138  bool( BLAZE_AVX512F_MODE ) >
139 {};
141 //*************************************************************************************************
142 
143 
144 //*************************************************************************************************
165 template< typename T1 // Type of the left-hand side operand
166  , typename T2 // Type of the right-hand side operand
167  , typename = void > // Restricting condition
169  : public BoolConstant< HasSIMDMaxHelper< Decay_t<T1>, Decay_t<T2> >::value >
170 {};
171 //*************************************************************************************************
172 
173 
174 //*************************************************************************************************
187 template< typename T1 // Type of the left-hand side operand
188  , typename T2 > // Type of the right-hand side operand
190 //*************************************************************************************************
191 
192 } // namespace blaze
193 
194 #endif
BoolConstant< false > FalseType
Type/value traits base class.The FalseType class is used as base class for type traits and value trai...
Definition: FalseType.h:61
Header file for the FalseType type/value trait base class.
#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.
#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.
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.The EnableIf_t alias declaration provides a convenient...
Definition: EnableIf.h:138
Availability of a SIMD max operation for the given data types.Depending on the available instruction ...
Definition: HasSIMDMax.h:168
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
constexpr bool IsNumeric_v
Auxiliary variable template for the IsNumeric type trait.The IsNumeric_v variable template provides a...
Definition: IsNumeric.h:143
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.
constexpr bool HasSIMDMax_v
Auxiliary variable template for the HasSIMDMax type trait.The HasSIMDMax_v variable template provides...
Definition: HasSIMDMax.h:189
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.The BoolConstant class template represents ...
Definition: IntegralConstant.h:101
Header file for the IsSigned type trait.
Header file for the IsUnsigned type trait.
Header file for the IntegralConstant class template.
System settings for the SSE mode.
Header file for the complex data type.