Abs.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_SIMD_ABS_H_
36 #define _BLAZE_MATH_SIMD_ABS_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
44 #include <blaze/system/Inline.h>
46 
47 
48 namespace blaze {
49 
50 //=================================================================================================
51 //
52 // 8-BIT INTEGRAL SIMD TYPES
53 //
54 //=================================================================================================
55 
56 //*************************************************************************************************
65 BLAZE_ALWAYS_INLINE const SIMDuint8 abs( const SIMDint8& a ) noexcept
66 #if BLAZE_AVX512BW_MODE
67 {
68  return _mm512_abs_epi8( a.value );
69 }
70 #elif BLAZE_AVX2_MODE
71 {
72  return _mm256_abs_epi8( a.value );
73 }
74 #elif BLAZE_SSSE3_MODE
75 {
76  return _mm_abs_epi8( a.value );
77 }
78 #else
79 = delete;
80 #endif
81 //*************************************************************************************************
82 
83 
84 
85 
86 //=================================================================================================
87 //
88 // 16-BIT INTEGRAL SIMD TYPES
89 //
90 //=================================================================================================
91 
92 //*************************************************************************************************
101 BLAZE_ALWAYS_INLINE const SIMDuint16 abs( const SIMDint16& a ) noexcept
102 #if BLAZE_AVX512BW_MODE
103 {
104  return _mm512_abs_epi16( a.value );
105 }
106 #elif BLAZE_AVX2_MODE
107 {
108  return _mm256_abs_epi16( a.value );
109 }
110 #elif BLAZE_SSSE3_MODE
111 {
112  return _mm_abs_epi16( a.value );
113 }
114 #else
115 = delete;
116 #endif
117 //*************************************************************************************************
118 
119 
120 
121 
122 //=================================================================================================
123 //
124 // 32-BIT INTEGRAL SIMD TYPES
125 //
126 //=================================================================================================
127 
128 //*************************************************************************************************
137 BLAZE_ALWAYS_INLINE const SIMDuint32 abs( const SIMDint32& a ) noexcept
138 #if BLAZE_AVX512F_MODE || BLAZE_MIC_MODE
139 {
140  return _mm512_abs_epi32( a.value );
141 }
142 #elif BLAZE_AVX2_MODE
143 {
144  return _mm256_abs_epi32( a.value );
145 }
146 #elif BLAZE_SSSE3_MODE
147 {
148  return _mm_abs_epi32( a.value );
149 }
150 #else
151 = delete;
152 #endif
153 //*************************************************************************************************
154 
155 
156 
157 
158 //=================================================================================================
159 //
160 // 64-BIT INTEGRAL SIMD TYPES
161 //
162 //=================================================================================================
163 
164 //*************************************************************************************************
173 BLAZE_ALWAYS_INLINE const SIMDuint64 abs( const SIMDint64& a ) noexcept
174 #if BLAZE_AVX512F_MODE || BLAZE_MIC_MODE
175 {
176  return _mm512_abs_epi64( a.value );
177 }
178 #else
179 = delete;
180 #endif
181 //*************************************************************************************************
182 
183 
184 
185 
186 //=================================================================================================
187 //
188 // 32-BIT FLOATING POINT SIMD TYPES
189 //
190 //=================================================================================================
191 
192 //*************************************************************************************************
201 template< typename T > // Type of the operand
202 BLAZE_ALWAYS_INLINE const SIMDfloat abs( const SIMDf32<T>& a ) noexcept
203 #if BLAZE_AVX512F_MODE || BLAZE_MIC_MODE
204 {
205  return _mm512_abs_ps( (~a).eval().value );
206 }
207 #else
208 = delete;
209 #endif
210 //*************************************************************************************************
211 
212 
213 
214 
215 //=================================================================================================
216 //
217 // 64-BIT FLOATING POINT SIMD TYPES
218 //
219 //=================================================================================================
220 
221 //*************************************************************************************************
230 template< typename T > // Type of the operand
231 BLAZE_ALWAYS_INLINE const SIMDdouble abs( const SIMDf64<T>& a ) noexcept
232 #if BLAZE_AVX512F_MODE || BLAZE_MIC_MODE
233 {
234  return _mm512_abs_pd( (~a).eval().value );
235 }
236 #else
237 = delete;
238 #endif
239 //*************************************************************************************************
240 
241 } // namespace blaze
242 
243 #endif
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
decltype(auto) eval(const DenseMatrix< MT, SO > &dm)
Forces the evaluation of the given dense matrix expression dm.
Definition: DMatEvalExpr.h:797
decltype(auto) abs(const DenseMatrix< MT, SO > &dm)
Applies the abs() function to each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1176
Header file for the basic SIMD types.
System settings for the SSE mode.
System settings for the inline keywords.