Blaze 3.9
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
55namespace blaze {
56
57//=================================================================================================
58//
59// CLASS DEFINITION
60//
61//=================================================================================================
62
63//*************************************************************************************************
68template< typename T1 // Type of the left-hand side operand
69 , typename T2 // Type of the right-hand side operand
70 , typename = void > // Restricting condition
71struct HasSIMDMaxHelper
72 : public FalseType
73{};
75//*************************************************************************************************
76
77
78//*************************************************************************************************
80template< typename T >
81struct 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//*************************************************************************************************
93template< typename T >
94struct 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//*************************************************************************************************
106template< typename T >
107struct 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//*************************************************************************************************
119template<>
120struct 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//*************************************************************************************************
132template<>
133struct 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//*************************************************************************************************
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< HasSIMDMaxHelper< 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 HasSize type trait.
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 IsSigned type trait.
Header file for the IsUnsigned type trait.
Header file for the RemoveCVRef type trait.
constexpr bool HasSIMDMax_v
Auxiliary variable template for the HasSIMDMax type trait.
Definition: HasSIMDMax.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_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
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 max operation for the given data types.
Definition: HasSIMDMax.h:169
Generic wrapper for a compile time constant integral value.
Definition: IntegralConstant.h:74
System settings for the SSE mode.