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_AVX2_MODE
67 {
68  return _mm256_abs_epi8( a.value );
69 }
70 #elif BLAZE_SSSE3_MODE
71 {
72  return _mm_abs_epi8( a.value );
73 }
74 #else
75 = delete;
76 #endif
77 //*************************************************************************************************
78 
79 
80 
81 
82 //=================================================================================================
83 //
84 // 16-BIT INTEGRAL SIMD TYPES
85 //
86 //=================================================================================================
87 
88 //*************************************************************************************************
97 BLAZE_ALWAYS_INLINE const SIMDuint16 abs( const SIMDint16& a ) noexcept
98 #if BLAZE_AVX2_MODE
99 {
100  return _mm256_abs_epi16( a.value );
101 }
102 #elif BLAZE_SSSE3_MODE
103 {
104  return _mm_abs_epi16( a.value );
105 }
106 #else
107 = delete;
108 #endif
109 //*************************************************************************************************
110 
111 
112 
113 
114 //=================================================================================================
115 //
116 // 32-BIT INTEGRAL SIMD TYPES
117 //
118 //=================================================================================================
119 
120 //*************************************************************************************************
129 BLAZE_ALWAYS_INLINE const SIMDuint32 abs( const SIMDint32& a ) noexcept
130 #if BLAZE_MIC_MODE
131 {
132  return _mm512_abs_epi32( a.value );
133 }
134 #elif BLAZE_AVX2_MODE
135 {
136  return _mm256_abs_epi32( a.value );
137 }
138 #elif BLAZE_SSSE3_MODE
139 {
140  return _mm_abs_epi32( a.value );
141 }
142 #else
143 = delete;
144 #endif
145 //*************************************************************************************************
146 
147 
148 
149 
150 //=================================================================================================
151 //
152 // 64-BIT INTEGRAL SIMD TYPES
153 //
154 //=================================================================================================
155 
156 //*************************************************************************************************
165 BLAZE_ALWAYS_INLINE const SIMDuint64 abs( const SIMDint64& a ) noexcept
166 #if BLAZE_MIC_MODE
167 {
168  return _mm512_abs_epi64( a.value );
169 }
170 #else
171 = delete;
172 #endif
173 //*************************************************************************************************
174 
175 } // namespace blaze
176 
177 #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
const DMatForEachExpr< MT, Abs, SO > abs(const DenseMatrix< MT, SO > &dm)
Applies the abs() function to each single element of the dense matrix dm.
Definition: DMatForEachExpr.h:1074
Header file for the basic SIMD types.
System settings for the SSE mode.
System settings for the inline keywords.