Blaze  3.6
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>
53 
54 
55 namespace blaze {
56 
57 //=================================================================================================
58 //
59 // CLASS DEFINITION
60 //
61 //=================================================================================================
62 
63 //*************************************************************************************************
68 template< typename T1 // Type of the left-hand side operand
69  , typename T2 // Type of the right-hand side operand
70  , typename = void > // Restricting condition
71 struct HasSIMDMaxHelper
72  : public FalseType
73 {};
75 //*************************************************************************************************
76 
77 
78 //*************************************************************************************************
80 template< typename T >
81 struct HasSIMDMaxHelper< T, T, EnableIf_t< IsNumeric_v<T> && IsIntegral_v<T> && Has1Byte_v<T> > >
82  : public BoolConstant< ( bool( BLAZE_SSE2_MODE ) && IsUnsigned_v<T> ) ||
83  ( bool( BLAZE_SSE4_MODE ) && IsSigned_v<T> ) ||
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_t< IsNumeric_v<T> && IsIntegral_v<T> && Has2Bytes_v<T> > >
95  : public BoolConstant< ( bool( BLAZE_SSE2_MODE ) && IsSigned_v<T> ) ||
96  ( bool( BLAZE_SSE4_MODE ) && IsUnsigned_v<T> ) ||
97  bool( BLAZE_AVX2_MODE ) ||
98  bool( BLAZE_AVX512BW_MODE ) >
99 {};
101 //*************************************************************************************************
102 
103 
104 //*************************************************************************************************
106 template< typename T >
107 struct HasSIMDMaxHelper< T, T, EnableIf_t< IsNumeric_v<T> && IsIntegral_v<T> && Has4Bytes_v<T> > >
108  : public BoolConstant< bool( BLAZE_SSE4_MODE ) ||
109  bool( BLAZE_AVX2_MODE ) ||
110  bool( BLAZE_MIC_MODE ) ||
111  bool( BLAZE_AVX512F_MODE ) >
112 {};
114 //*************************************************************************************************
115 
116 
117 //*************************************************************************************************
119 template<>
120 struct HasSIMDMaxHelper< float, float >
121  : public BoolConstant< bool( BLAZE_SSE_MODE ) ||
122  bool( BLAZE_AVX_MODE ) ||
123  bool( BLAZE_MIC_MODE ) ||
124  bool( BLAZE_AVX512F_MODE ) >
125 {};
127 //*************************************************************************************************
128 
129 
130 //*************************************************************************************************
132 template<>
133 struct HasSIMDMaxHelper< double, double >
134  : public BoolConstant< bool( BLAZE_SSE2_MODE ) ||
135  bool( BLAZE_AVX_MODE ) ||
136  bool( BLAZE_MIC_MODE ) ||
137  bool( BLAZE_AVX512F_MODE ) >
138 {};
140 //*************************************************************************************************
141 
142 
143 //*************************************************************************************************
164 template< 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< HasSIMDMaxHelper< RemoveCVRef_t<T1>, RemoveCVRef_t<T2> >::value >
169 {};
170 //*************************************************************************************************
171 
172 
173 //*************************************************************************************************
186 template< 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
BoolConstant< false > FalseType
Type/value traits base class.The FalseType class is used as base class for type traits and value trai...
Definition: IntegralConstant.h:121
#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:72
#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 RemoveCVRef type trait.
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
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:167
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.
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.The BoolConstant alias template represents ...
Definition: IntegralConstant.h:110
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.
constexpr bool HasSIMDMax_v
Auxiliary variable template for the HasSIMDMax type trait.The HasSIMDMax_v variable template provides...
Definition: HasSIMDMax.h:188
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