HasSIMDEqual.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_TYPETRAITS_HASSIMDEQUAL_H_
36 #define _BLAZE_MATH_TYPETRAITS_HASSIMDEQUAL_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <blaze/system/Compiler.h>
45 #include <blaze/util/Complex.h>
46 #include <blaze/util/EnableIf.h>
47 #include <blaze/util/FalseType.h>
52 
53 
54 namespace blaze {
55 
56 //=================================================================================================
57 //
58 // CLASS DEFINITION
59 //
60 //=================================================================================================
61 
62 //*************************************************************************************************
67 template< typename T1 // Type of the left-hand side operand
68  , typename T2 // Type of the right-hand side operand
69  , typename = void > // Restricting condition
70 struct HasSIMDEqualHelper
71  : public FalseType
72 {};
74 //*************************************************************************************************
75 
76 
77 //*************************************************************************************************
79 template< typename T >
80 struct HasSIMDEqualHelper< T, T, EnableIf_t< IsNumeric_v<T> && IsIntegral_v<T> > >
81  : public BoolConstant< ( bool( BLAZE_SSE2_MODE ) && sizeof(T) <= 4UL ) ||
82  ( bool( BLAZE_SSE4_MODE ) && sizeof(T) == 8UL ) ||
83  ( bool( BLAZE_AVX2_MODE ) ) ||
84  ( bool( BLAZE_MIC_MODE ) && sizeof(T) == 4UL ) ||
85  ( bool( BLAZE_AVX512BW_MODE ) && sizeof(T) <= 2UL ) ||
86  ( bool( BLAZE_AVX512F_MODE ) && sizeof(T) >= 4UL ) >
87 {};
88 
89 template< typename T >
90 struct HasSIMDEqualHelper< complex<T>, complex<T>, EnableIf_t< IsNumeric_v<T> && IsIntegral_v<T> > >
91  : public BoolConstant< ( bool( BLAZE_SSE2_MODE ) && sizeof(T) <= 4UL ) ||
92  ( bool( BLAZE_SSE4_MODE ) && sizeof(T) == 8UL ) ||
93  ( bool( BLAZE_AVX2_MODE ) ) ||
94  ( bool( BLAZE_MIC_MODE ) && sizeof(T) == 4UL ) ||
95  ( bool( BLAZE_AVX512BW_MODE ) && sizeof(T) <= 2UL ) ||
96  ( bool( BLAZE_AVX512F_MODE ) && sizeof(T) >= 4UL ) >
97 {};
99 //*************************************************************************************************
100 
101 
102 //*************************************************************************************************
104 #if !( BLAZE_AVX512F_MODE || BLAZE_MIC_MODE ) || !BLAZE_GNU_COMPILER
105 template<>
106 struct HasSIMDEqualHelper< float, float >
107  : public BoolConstant< bool( BLAZE_SSE_MODE ) ||
108  bool( BLAZE_AVX_MODE ) ||
109  bool( BLAZE_MIC_MODE ) ||
110  bool( BLAZE_AVX512F_MODE ) >
111 {};
112 
113 template<>
114 struct HasSIMDEqualHelper< complex<float>, complex<float> >
115  : public BoolConstant< bool( BLAZE_SSE_MODE ) ||
116  bool( BLAZE_AVX_MODE ) ||
117  bool( BLAZE_MIC_MODE ) ||
118  bool( BLAZE_AVX512F_MODE ) >
119 {};
120 
121 template<>
122 struct HasSIMDEqualHelper< double, double >
123  : public BoolConstant< bool( BLAZE_SSE2_MODE ) ||
124  bool( BLAZE_AVX_MODE ) ||
125  bool( BLAZE_MIC_MODE ) ||
126  bool( BLAZE_AVX512F_MODE ) >
127 {};
128 
129 template<>
130 struct HasSIMDEqualHelper< complex<double>, complex<double> >
131  : public BoolConstant< bool( BLAZE_SSE2_MODE ) ||
132  bool( BLAZE_AVX_MODE ) ||
133  bool( BLAZE_MIC_MODE ) ||
134  bool( BLAZE_AVX512F_MODE ) >
135 {};
136 #endif
137 
138 //*************************************************************************************************
139 
140 
141 //*************************************************************************************************
162 template< typename T1 // Type of the left-hand side operand
163  , typename T2 // Type of the right-hand side operand
164  , typename = void > // Restricting condition
166  : public BoolConstant< HasSIMDEqualHelper< Decay_t<T1>, Decay_t<T2> >::value >
167 {};
168 //*************************************************************************************************
169 
170 
171 //*************************************************************************************************
184 template< typename T1 // Type of the left-hand side operand
185  , typename T2 > // Type of the right-hand side operand
187 //*************************************************************************************************
188 
189 } // namespace blaze
190 
191 #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
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
Availability of a SIMD equality comparison for the given data types.Depending on the available instru...
Definition: HasSIMDEqual.h:165
Compiler-specific system settings.
constexpr bool HasSIMDEqual_v
Auxiliary variable template for the HasSIMDEqual type trait.The HasSIMDEqual_v variable template prov...
Definition: HasSIMDEqual.h:186
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
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 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